This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
The FAQ says that using g++ and -lsupc++ together will link against libsupc++ instead of libstdc++. This doesn't work on GNU/Linux: jim@squirrel:~/test $ g++ -o sizeof sizeof.cc -lsupc++ jim@squirrel:~/test $ ldd sizeof libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x7002c000) libm.so.6 => /lib/libm.so.6 (0x700f0000) libgcc_s.so.1 => /usr/local/lib/libgcc_s.so.1 (0x70184000) libc.so.6 => /lib/libc.so.6 (0x701a0000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x70000000) jim@squirrel:~/test $ gcc -o sizeof sizeof.cc -lsupc++ jim@squirrel:~/test $ ldd sizeof libc.so.6 => /lib/libc.so.6 (0x7002c000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x70000000)
What FAQ, I do not see any mention of this in <http://gcc.gnu.org/faq.html> or <http://gcc.gnu.org/ onlinedocs/libstdc++/faq/index.html>?
If the only functions from libstdc++.a which you need are language support functions (those listed in clause 18 of the standard, e.g., new and delete), then try linking against libsupc++.a (usually specifying -lsupc++ when calling g++ for the final link step will do it). This library contains only those support routines, one per object file. But if you are using anything from the rest of the library, such as IOStreams or vectors, then you'll still need pieces from libstdc++.a. It does say to use g++ though :( This should change.
Created an attachment (id=6137) [edit] A c program that shouldn't use anything from libstdc++ For completeness this is the program I tried with g++ and g++ -lsupc++
Indeed, what FAQ? You need to be using gcc, not g++ to do this kind of thing. ie: gcc -o sizeof sizeof.cc -lsupc++ -benjamin
Sorry, the libstdc++ FAQ: http://gcc.gnu.org/onlinedocs/libstdc++/faq/index.html#2_5
Subject: Bug 15074 CVSROOT: /cvs/gcc Module name: gcc Changes by: bkoz@gcc.gnu.org 2004-05-13 15:14:08 Modified files: libstdc++-v3 : ChangeLog libstdc++-v3/docs/html/faq: index.html Log message: 2004-05-13 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/15074 * docs/html/faq/index.html: Update docs for libsupc++ usage. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&r1=1.2470&r2=1.2471 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/docs/html/faq/index.html.diff?cvsroot=gcc&r1=1.64&r2=1.65
This is a documentation error, now fixed.
Subject: Bug 15074 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: bkoz@gcc.gnu.org 2004-05-13 15:27:42 Modified files: libstdc++-v3 : ChangeLog libstdc++-v3/docs/html/faq: index.html Log message: 2004-05-13 Benjamin Kosnik <bkoz@redhat.com> PR libstdc++/15074 * docs/html/faq/index.html: Update docs for libsupc++ usage. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.2224.2.98&r2=1.2224.2.99 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libstdc++-v3/docs/html/faq/index.html.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.63.4.1&r2=1.63.4.2
Fixed for 3.4.1.