問題描述
我正在將我的項目從 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"不匹配的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!