views:

87

answers:

1

I am trying to link something I wrote to an existing shared library. I using gcc 3.2.3 on RedHat 3. When I get to the link phase I get an error that says:

object_files_linux/hvm_example.o(.text+0x233):~/hvm_example.cpp:254: undefined reference to `xoc::hvmapi::id(std::basic_string, std::allocator > const&)'

I have run the nm command on the object file and it shows this for the function in question:

U xoc::hvmapi::id(std::basic_string, std::allocator > const&)

I run nm on the shared library and it show this for the function in question:

T xoc::hvmapi::id(__STL::basic_string, _STL::allocator > const&)

My question is : Is the link failure because my function uses the std namespace and the shared library uses the _STL namespace?

Is there a work around?

I don't have access to the source of the shared library source code but I do have header files that use the std namespace for the parameters.

Thanks, Mike

A: 

The shared library you are using was likely built with STLport. Read the documentation for that shared library -- it should clearly state that you have to compile your code with STLport as well, and the specific version of STLport you should be using.

Note that different versions of g++ are also not link-compatible, particularly around versions 3.2.x, 3.3.x and 3.4.x. You must compile with the same version of g++ as the one that was used to build your 3rd-party shared library.

Employed Russian