gnu/13525: gcc fails load against library with both C++ and C modules

Gerald Pfeifer gerald at FreeBSD.org
Wed May 21 06:44:41 PDT 2003


Synopsis: gcc fails load against library with both C++ and C modules

State-Changed-From-To: feedback->closed
State-Changed-By: gerald
State-Changed-When: Wed May 21 06:41:18 PDT 2003
State-Changed-Why: 
I debugged this in further depth, and it is apparently operator error: As
soon as you use any C++ library routines (whether directly or indirectly)
you need to link the final binary using g++, not gcc, and the g++ driver
then will link any additional libraries required.

The following would have worked for the example provided:
  gcc -Wall -c -fpic a.c
  c++ -Wall -c -fpic b.cc
  gcc -shared -o libab.so a.o b.o
  gcc -Wall -c c.c
  c++ -o c c.o ./libab.so

http://www.freebsd.org/cgi/query-pr.cgi?pr=13525


More information about the freebsd-bugs mailing list