was converting my projects from VS2012 to VS2015.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 VS2012 to VS2015.
How can I find out that which projectis causing the error? Here I am quoting the error: Error LNK2038 mismatch detected for '_MSC_VER': value '1700' doesn't match value '1900' in xxxx.obj
Error LNK2038 mismatch detected for '_MSC_VER': value '1700' doesn't match value '1900' in xxxx.obj
1 Answer 1
This indicates that some of your code or static libraries are built with the Visual Studio 2012 compiler & C/C++ Runtime headers/libraries, while other code is built with Visual Studio 2015 compiler & C/C++ Runtime headers/libraries.
While some kinds of linkage are stable between releases of Visual C++ (old-school C, extern "C" functions, COM interfaces, etc.), all C++ linkage is version-dependent. This is especially true of the Standard C++ Library (a.k.a. the Standard Template Library) which changes memory layout from version to version so can crash at runtime.
To guard against this, the library adds the _MSC_VER link stamp to the output code modules to catch these kinds of mismatches at link time.
By design, Visual Studio 2017/2019's C/C++ Runtime has been made binary compatible with Visual Studio 2015 Update 3 C/C++ Runtime to simplify adoption. This is not the normal pattern, and VS 2012 is not binary compatible with VS 2015/2017/2019. See this blog post and Microsoft Docs.
Comments
Explore related questions
See similar questions with these tags.