2

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

Jonathan Leffler
759k145 gold badges961 silver badges1.3k bronze badges
asked Jan 14, 2019 at 3:01

1 Answer 1

2

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.

answered Jan 14, 2019 at 18:48
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.