# cat foo.h struct foo { bool check() const; }; # cat foo.cpp #include "foo.h" bool foo::check() const { return true; } # cat foo-c.cpp #include "foo.h" extern "C" int foo_check(const foo* obj) { return obj->check(); } # build g++ -O2 foo.cpp -o libfoo.so -shared g++ -O2 foo-c.cpp -o libfoo-c.so -shared -L. -lfoo # link test gcc libfoo.so LD_LIBRARY_PATH=./ gcc libfoo-c.so # with binutils-2.15.94* it works fine 2x: /usr/lib/gcc/i686-pld-linux/4.0.0/../../../crt1.o(.text+0x18): In function `_start': init.c: undefined reference to `main' collect2: ld returned 1 exit status # LD_LIBRARY_PATH=. ldd libfoo*.so libfoo-c.so: linux-gate.so.1 => (0xffffe000) libfoo.so => ./libfoo.so (0x40002000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40004000) libm.so.6 => /lib/libm.so.6 (0x400d4000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x400f8000) libc.so.6 => /lib/libc.so.6 (0x40103000) /lib/ld-linux.so.2 (0x80000000) libfoo.so: linux-gate.so.1 => (0xffffe000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40002000) libm.so.6 => /lib/libm.so.6 (0x400d2000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x400f6000) libc.so.6 => /lib/libc.so.6 (0x40101000) /lib/ld-linux.so.2 (0x80000000) # with binutils snapshot it doesn't work (ftp://sources.redhat.com/pub/binutils/snapshots2.15.96) 2x: /usr/lib/gcc/i686-pld-linux/4.0.0/../../../crt1.o: In function `_start': init.c:(.text+0x18): undefined reference to `main' /usr/bin/../lib/libstdc++.so.6: undefined reference to [EMAIL PROTECTED]' /usr/bin/../lib/libstdc++.so.6: undefined reference to [EMAIL PROTECTED]' /usr/bin/../lib/libstdc++.so.6: undefined reference to [EMAIL PROTECTED]' /usr/bin/../lib/libstdc++.so.6: undefined reference to [EMAIL PROTECTED]' /usr/bin/../lib/libstdc++.so.6: undefined reference to [EMAIL PROTECTED]' /usr/bin/../lib/libstdc++.so.6: undefined reference to [EMAIL PROTECTED]' /usr/bin/../lib/libstdc++.so.6: undefined reference to [EMAIL PROTECTED]' /usr/bin/../lib/libstdc++.so.6: undefined reference to [EMAIL PROTECTED]' /usr/bin/../lib/libstdc++.so.6: undefined reference to [EMAIL PROTECTED]' /usr/bin/../lib/libstdc++.so.6: undefined reference to [EMAIL PROTECTED]' /usr/bin/../lib/libstdc++.so.6: undefined reference to [EMAIL PROTECTED]' collect2: ld returned 1 exit status # LD_LIBRARY_PATH=. ldd libfoo*.so libfoo-c.so: linux-gate.so.1 => (0xffffe000) libfoo.so => ./libfoo.so (0x40002000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40004000) libm.so.6 => /lib/libm.so.6 (0x400d4000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x400f8000) libc.so.6 => /lib/libc.so.6 (0x40103000) /lib/ld-linux.so.2 (0x80000000) libfoo.so: linux-gate.so.1 => (0xffffe000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x40002000) libm.so.6 => /lib/libm.so.6 (0x400d2000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x400f6000) libc.so.6 => /lib/libc.so.6 (0x40101000) /lib/ld-linux.so.2 (0x80000000) Do I need add the -lstdc++ to link similiar C-apis now?
-- Summary: [C-api -> C++ lib] undefined symbol _Unwind* http://sources.redhat.com/bugzilla/enter_bug.cgi Product: binutils Version: 2.15 Status: NEW Severity: normal Priority: P2 Component: ld AssignedTo: unassigned at sources dot redhat dot com ReportedBy: pluto at pld-linux dot org CC: bug-binutils at gnu dot org GCC build triplet: i686-pld-linux GCC host triplet: i686-pld-linux GCC target triplet: i686-pld-linux http://sources.redhat.com/bugzilla/show_bug.cgi?id=815 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils