This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Static Linking stdc++


Hi there,

You should not use gcc to link a c++ program,
it is a much better idea to use g++ and tell
it not to link in the standard files and such.

On my system i made this work using:

LD = /usr/local/gcc3.2/bin/g++
LDFLAGS = -O3 -nostdlib
LDPATH =
LDLIBS = /usr/lib/crt1.o /usr/lib/crti.o /usr/local/gcc3.2/lib/gcc-lib/i686-pc-linux-gnu/3.2/crtbegin.o -L/usr/local/gcc3.2/lib/gcc-lib/i686-pc-linux-gnu/3.2 -L/usr/local/gcc3.2/lib/gcc-lib/i686-pc-linux-gnu/3.2/../../.. -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc /usr/local/gcc3.2/lib/gcc-lib/i686-pc-linux-gnu/3.2/crtend.o /usr/lib/crtn.o

As you can see, g++ arranges for the linking with quite a
few supporting libraries:) I found the proper ones by telling
g++ to be verbose (-v) during linking.

Yours sincerely,

Bjorn


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]