简体   繁体   中英

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.

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.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM