John Morris wrote: > 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. Are you sure that's not 3.2 or 3.3 that your old RH system was using? According to <http://gcc.gnu.org/onlinedocs/libstdc++/abi.html>, the last version that used v5 was gcc v3.3.3. > 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. You can't just pick and choose which version of the library is used. It is highly coupled to the version of gcc; in other words, the version of gcc that you use will determine which version of libstdc++ your code gets linked to, and nothing else. They go hand in hand. Generally when you are aiming for binary compatibility across multiple systems/platforms, the only way to achieve this is to set the compile environment to the oldest combination of libraries and compilers that you want to support. There is no way to go backwards, i.e. use a recent gcc but link to an older library. If you want to produce binaries that still link against an older libstdc++ you'll have to install gcc 3.3 on your system and use that. The libstdc++.so.5 that ubuntu provides is for compatibility for existing binaries that were compiled with gcc 3.3, it is not possible to link against it for new programs compiled with gcc 3.4 or 4.x. Brian