Link to specific stdc ++ library

I have a C ++ application that I am trying to build under Linux, it needs to be linked with a third party shared library, however this library was built with a fairly recent version of GCC / glibc (4.8.3 / 2.18). When I try to build my application using a less recent version of GCC / glibc (4.4.7 / 2.12) the associated build phase fails, with ld complaining about undefined references, which are function references defined in the newer version of libstdc ++.

A third party provided me with a pre-compiled version of libstdc ++ and libgcc_s to use with the library, but how do I use those versions in my assembly?

How do I tell GCC to use precompiled libraries instead of system libraries, but when using the GCC system?

I tried to use the "-nodefaultlibs" option and include the "-lstdC ++" and "-L" options, but it doesn't seem to affect undefined links.

An example of the error I am getting when linking:

undefined reference to std::__throw_bad_function_call()@GLIBCXX_3.4.14' undefined reference to std::length_error::~length_error()@GLIBCXX_3.4.15'

+3


source to share


1 answer


I was able to get the application to build successfully by specifying the full path to the libstdc ++ and libgcc_s shared objects in the bind command object list (e.g. / home / mike / Downloads / libstdc ++. So.6). This way I didn't need to use any additional parameters like "-nostdlibs" and only needed to ensure that related shared objects were available via LD_LIBRARY_PATH when starting the application.



+1


source







All Articles