Linking the correct libstdc++
John Morris
john.morris@bristol.ac.uk
Fri Apr 27 13:26:00 GMT 2007
Hello, I am having some problems with libstdc++, can anybody help?
My programme compiles and links fine using a RHEL3 PC, gcc 3.4 with
libstdc++.so.5. It runs reasonably well and I am happy.
I have just changed my laptop (different from PC above) from RHEL3 to
ubuntu as everything about it looks and feels nicer. However, ubuntu
ships with libstdc++.so.5 and libstdc++.so.6, both in /usr/lib. I have
got gcc 3.4.
My code compiles under ubuntu, but it is linking the libstdc++.so.6 into
everything instead of libstdc++.so.5. This causes me great problems and
my programme dies almost straight away. I use 3rd party open-source
software which relies on libstdc++.so.5 and I will need to run it on the
RHEL3 machine mentioned before, that only has libstdc++.so.5.
Does anybody know what flag I need to set in my Makefile to get
everything linked with libstdc++.so.5? I can't have any trace of libstdc
++.so.6, 'ldd me.exe | grep libstdc++.so.6' has to come up blank.
The output, using -v, looks like this:
Lambda.o HistoCorrectLambda.o -lkernlib -lgrafX11 -lKtEvent
-lCLHEP-2.0.3.1 -lCore -lCint -lHist -lGraf -lGraf3d -lGpad -lTree
-lRint -lPostscript -lMatrix -lPhysics -ldl -lstdc++ -lm -lgcc_s -lgcc
-lpthread -lc -lgcc_s
-lgcc /usr/lib/gcc/i486-linux-gnu/3.4.6/crtend.o /usr/lib/gcc/i486-linux-gnu/3.4.6/../../../../lib/crtn.o
/usr/bin/ld: warning: libstdc++.so.5, needed
by /usr/lib/libCLHEP-2.0.3.1.so, may conflict with libstdc++.so.6
I think that I need to set what -lstdc++ is pointing to, but I don't
know how to do this.
Thanks in advance,
John
More information about the Gcc-help
mailing list