Linker error LNK2038: mismatch detected in Release mode

Wartin picture Wartin · Oct 31, 2010 · Viewed 59.3k times · Source

I am trying to port a small app of mine from Win XP and VS 2005 to Win 7 and VS 2010.

The app compiles and runs smoothly in Debug mode, however in Release mode I get the following error:

pcrecpp.lib(pcrecpp.obj) : error LNK2038: mismatch detected for 
'_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in LoginDlg.obj

Where should I start checking?

Answer

Alex Budovski picture Alex Budovski · Oct 31, 2010

Your app is being compiled in release mode, but you're linking against the debug version of PCRE, which had /MTd (or similar) set, thus causing the mismatch in iterator debugging level in the CRT.

Recompile PCRE in release mode to match your own application.

The detect_mismatch pragma in VS 2010 is what causes this error to be emitted.

See http://blogs.msdn.com/b/vcblog/archive/2009/06/23/stl-performance.aspx (search for _ITERATOR_DEBUG_LEVEL)