1

如何使在 Visual C++ 2010 中开发的 .cpp 解决方案在 Visual C++ 2012 中工作,每次尝试构建时都会出现以下错误,

    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

提前致谢..

4

1 回答 1

4

如果“重建解决方案”不能修复它,则可能是静态链接到使用以前版本的 Visual Studio 创建的 .lib 并且也使用标准模板库。

在这里引用MSDN

• 为了实现各种优化和调试检查,C++ 标准库实现有意破坏了 Visual Studio 版本(2005、2008、2010、2012)之间的二进制兼容性。使用 C++ 标准库时,禁止将使用不同版本编译的目标文件和静态库混合到一个二进制文件(EXE 或 DLL)中,并禁止使用 C++ 标准库编译的二进制文件之间传递 C++ 标准库对象。不同的版本。使用 Visual C++ 2010 编译的目标文件和静态库(使用 C++ 标准库)与使用 Visual Studio 2012 中的 Visual C++ 编译的目标文件和静态库(使用 C++ 标准库)混合会发出有关 _MSC_VER 不匹配的链接器错误,其中 _MSC_VER 是包含编译器的主要版本(Visual Studio 2012 中的 Visual C++ 为 1700)。

于 2013-04-11T12:10:57.417 回答