我正在将我的项目从 VS2010 转换为 VS2012.但是我在某些项目中遇到了 _MSC_VER 链接器错误.通过谷歌长时间浏览后,我发现问题是由于将在 VS2010 中创建的库链接到 VS2012.
I was converting my projects from VS2010 to VS2012.But I am getting an _MSC_VER linker error in certain projects. After a long surfing through google I found out that the issue is due to linking of a library created in VS2010 to VS2012.
如何找出导致错误的项目?我在这里引用错误:
How can I find out that which projectis causing the error? Here I am quoting the error:
Error 6 error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj D:ProjectLocationProjectname1.lib(CppFile2.obj) Projectname2
Error 15 error LNK2001: unresolved external symbol "private: static void __cdecl std::locale::facet::_Facet_Register(class std::locale::facet *)" (?_Facet_Registerlocale@CAXPAV123@@Z) D:ProjectLocationProjectname1.lib(CppFile3.obj) Projectname2
Error 13 error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj D:ProjectLocationProjectname1.lib(CppFile4.obj) Projectname2
Error 12 error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj D:ProjectLocationProjectname1.lib(CppFile5.obj) Projectname2
Error 10 error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj D:ProjectLocationProjectname1.lib(CppFile6.obj) Projectname2
Error 11 error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj D:ProjectLocationProjectname1.lib(CppFile7.obj) Projectname2
Error 9 error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj D:ProjectLocationProjectname1.lib(CppFile8.obj) Projectname2
Error 4 error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj D:ProjectLocationProjectname1.lib(CppFile9.obj) Projectname2
Error 14 error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj D:ProjectLocationProjectname1.lib(CppFile10.obj) Projectname2
Error 7 error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj D:ProjectLocationProjectname1.lib(CppFile11.obj) Projectname2
Error 8 error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj D:ProjectLocationProjectname1.lib(CppFile12.obj) Projectname2
Error 5 error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in CppFile1.obj D:ProjectLocationProjectname1.lib(CppFile13.obj) Projectname2
您正在尝试链接由不同版本的编译器编译的对象.这在现代版本的 VS 中不受支持,至少在您使用 C++ 标准库时不支持.标准库的不同版本是二进制不兼容的,因此您需要使用相同版本编译链接器的所有输入.确保重新编译所有要链接的对象.
You are trying to link objects compiled by different versions of the compiler. That's not supported in modern versions of VS, at least not if you are using the C++ standard library. Different versions of the standard library are binary incompatible and so you need all the inputs to the linker to be compiled with the same version. Make sure you re-compile all the objects that are to be linked.
编译器错误命名了所涉及的对象,因此问题的信息已经包含您正在寻找的答案.具体来说,您正在链接的静态库似乎需要重新编译.
The compiler error names the objects involved so the information the the question already has the answer you are looking for. Specifically it seems that the static library that you are linking needs to be re-compiled.
所以解决办法是用VS2012重新编译Projectname1.lib.
So the solution is to recompile Projectname1.lib with VS2012.
这篇关于错误 LNK2038:检测到“_MSC_VER"不匹配:值“1600"与 CppFile1.obj 中的值“1700"不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!