_ITERATOR_DEBUG_LEVEL error in visual studio

The solution:

Project Pages >> Configuration Properties >> C,C++ >> Preprocessor >> Preprocessor Definitions

Add _ITERATOR_DEBUG_LEVEL=0 in there worked. See also: How to set _ITERATOR_DEBUG_LEVEL in VS2010?


Compile everything you use with -D_ITERATOR_DEBUG_LEVEL=0 option. It is so by default in VS 2010 Release mode, but some things are still built with other options and so are not binary compatible.

In older visual studios there was _SECURE_SCL and i am not sure if some of code may still use it. Put somewhere (say into stdafx.h) a static check that these match.

#if _ITERATOR_DEBUG_LEVEL == 0 && _SECURE_SCL != 0 
#error _SECURE_SCL != 0 when _ITERATOR_DEBUG_LEVEL == 0 
#endif 

If you want to see what value _ITERATOR_DEBUG_LEVEL has then you can use some #pragma message in code to tell you.