2
votes

I've got a 3d party static library built with some older version of MSVC, and I successfully link it to my application in MSVC10 (VisualStudio2010). Now I upgraded to MSVC11, and I'm unable to link it:

2>LINK : fatal error C1047: The object or library file 'MyLib.lib' was created with an older compiler than other objects; rebuild old objects and libraries

I guess this happens because the lib was compiled with /GL option, so the object files don't really contain COFF, but some intermediate format. I don't have the library source-code to re-compile, and I don't want to make a dll out of it to link dynamically.

Is there a way - maybe some undocumented trick - to "re-compile" these obj's to COFF and eventually link them to MSVC11 application?

1

1 Answers

1
votes

Even if this was possible, you don't want to do this: linking object files that are built against different versions of the CRT usually ends in tears. More specifically, if two such object files both use the C++ Standard Library, it is all but certain that you will violate the One Definition Rule (ODR).

If you cannot rebuild the module using Visual C++ 2012, then you should encapsulate it within a dynamic library, built with Visual C++ 2010, and avoid using any C++ Standard Library types in the interface of that DLL.