mans
mans

Reputation: 18168

linker mismatch in msvc version. Is there any workaround for it?

I am trying to builda c++ code which was developed VS 2010

I can compile it, but during link, I am getting this error:

Error   1   error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in myfile.obj  

I know that it is because they are build with different version of MSVC, but is there any way that I can configure MSVC to use libraries compiled with older version of MSVC?

Edit 1

At the end , I decided to install VS2012 express and compile code with it. It seems the Microsoft doesn't like you to port one project from one version of MSVC to another one easily.

Upvotes: 0

Views: 1467

Answers (2)

Drop
Drop

Reputation: 13003

MSVC static libraries are binary incompatible between major versions (at least those which use Microsoft's STL implementation):

C++ Standard Library implementation intentionally breaks binary compatibility among versions of Visual Studio (2005, 2008, 2010, 2012). (source)

You can either:

  • recompile external library with same compiler
  • move your code to compiler same that external library use
  • link external library dynamically (.dll)

Upvotes: 1

Pierre Fourgeaud
Pierre Fourgeaud

Reputation: 14510

You have three solutions to solve this problem :

  • Recompile the VS2010 library in 2012 (but you need the sources). Or if there is already an available 2012 library (but you already check it I guess).
  • Or you can do :

    In Project Properties, select General and then change the "Platform Toolset" setting to "Visual Studio 2010 (v100)."

  • Or you can link your library as external.

Upvotes: 1

Related Questions