LNK2038 Linker Error in Visual C++


I got this error at the linking stage of compiling a Visual C++ project:

Error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj

This project was being linked with other libraries and the error referred to the _ITERATOR_DEBUG_LEVEL was defined with different values in my application and the external library.


The difference in the _ITERATOR_DEBUG_LEVEL typically happens if a Release version of a library is linked against a Debug version of another library or application. Make the two have the same build type and this error should go away.

If you cannot do that, then set the _ITERATOR_DEBUG_LEVEL in your project to match the value used in the other library.

Tried with: Visual Studio 2010 and Windows 7 x64

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.