This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Troubles linking with ld
On Tue, Feb 07, 2006 at 05:19:51PM -0500, securehell@hushmail.com wrote:
> ld -shared --whole-archive -o libnew.so file5.o libfiles12.a
> libfiles34.a
Don't. Use gcc -shared instead; it knows how to invoke ld correctly
to link shared libraries.
> gcc -m64 -c -Wall -fPIC -g -o main.o main.cpp
> ld -lc -o main main.o libnew.so
> /usr/bin/ld: warning: cannot find entry symbol _start; defaulting
> to 00000000004010a0
> main.o(.gnu.linkonce.d.DW.ref.__gxx_personality_v0+0x0): undefined
> reference to `__gxx_personality_v0'
> libnew.so: undefined reference to `fstat'
Especially true for executables. And in this case, you need to link
with g++, not gcc.
--
Daniel Jacobowitz
CodeSourcery