1

How can I make a .cpp solution developed in Visual C++ 2010 work in Visual C++ 2012, I get the error below everytime I try to build,

    1>DinaPhysics-vc10-md-32-d.lib(smPrinter.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smEventGeneratorTrait.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smIntegralType.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smTypes.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVec3rBase.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVec3r.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVec2rBase.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVec2r.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVec3dBase.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVec3d.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVec4r.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVecTypes.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smMath.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smUtil.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVec4rBase.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVec2d.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVec2dBase.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>DinaPhysics-vc10-md-32-d.lib(smVec4dBase.obj) : error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in ShipDeckLandingExample.obj
1>..\..\..\Bin\VC10-32\Debug\ShipDeckLandingExample-vc10-md-32-d.exe : fatal error LNK1319: 18 mismatches detected

Thanks in advance..

IssamLaradji
  • 6,637
  • 8
  • 43
  • 68

1 Answers1

4

If "Rebuild solution" doesn't fix it, it's possible that you are linking statically to a .lib that was created with a previous version of Visual Studio, and that also uses the Standard Template Library.

Quoting from MSDN here

β€’To implement various optimizations and debugging checks, the C++ Standard Library implementation intentionally breaks binary compatibility among versions of Visual Studio (2005, 2008, 2010, 2012). When the C++ Standard Library is used, this forbids the mixing of object files and static libraries that are compiled by using different versions into one binary (EXE or DLL), and forbids the passing of C++ Standard Library objects between binaries that are compiled by using different versions. The mixing of object files and static libraries (using the C++ Standard Library) that were compiled by using Visual C++ 2010 with those that were compiled by using Visual C++ in Visual Studio 2012 emits linker errors about _MSC_VER mismatch, where _MSC_VER is the macro that contains the compiler's major version (1700 for Visual C++ in Visual Studio 2012). This check cannot detect DLL mixing, and cannot detect mixing that involves Visual C++ 2008 or earlier.

Roger Rowland
  • 25,885
  • 11
  • 72
  • 113
  • I can't rebuild the solution, I get errors, so is there an easy way to fix this? I don't really use visual studio, so linking and resolving mismatches are not my cup of tea :). However, my project requires me to download a software, for helicopter control ,and it is only available in VS 2010 version, thus, creating a new project and copy pasting the source code might not work at all, since its licensed. Therefore, is it possible to convert the project to make it work in VS 2012? – IssamLaradji Apr 11 '13 at 12:26
  • 1
    If you can't get a VS2012 version of the `lib` you need, there is no way that I know of to fix this. You will have to use VS2010 until the third-party developers provide a compatible version. Or maybe someone will be along shortly to contradict me ;-) – Roger Rowland Apr 11 '13 at 12:46