I'm trying to link my application with a static library built in a different version of Visual Studio (I'm using VS2010 and the lib is built with VS2008). The static lib uses STL internally and I'm getting linker errors that some basic_string methods cannot be found.
I understand that if the static lib uses STL in its public interface then this is impossible, since the STL objects are binarily incompatible. But this is not the case. None of the methods from the lib that I am calling use STL and I am passing no STL objects to the lib. But internally the static lib uses STL in it's own functions.
It looks like the library does not have the STL code compiled into it, and the linker is trying to link the STL into the internal methods. My question is is there any way to compile the static lib to statically link against the STL and include all the code inside of it?
I should mention that my own application also uses STL. But it seems that both versions could be compiled in provided that they are never passed to each other.
If you are linking to a static library, and this library is dependent on the version X of the standard C++ library, then your application needs to be linked with version X, in addition to version Y you may be using in your application.
Since several exported symbol names of both, version X and version Y of the standard library will be the same, you end up with a linker error.
Could you wrap the third-party library in a DLL? That would solve the issue.