_ITERATOR_DEBUG_LEVEL error in visual studio

可紊 提交于 2019-11-29 09:08:16

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.

RIK

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?

I found another way to generate these errors.

I was using the Visual Studio 2010 batch build to build all possible combinations of platform and configuration and I was getting these errors. Looking at the output revealed that batch build was not honoring the project dependencies -- hence linking a stale library from the Release build witha freshly compiled Debug obj file.

Several lines later in the build output it built the Debug version of the library.

Doing the "batch build" by hand (i.e. manually selecting the various combinations of platform and configuration) produced a clean build.

Moral: Do not use Visual Studio 2010 batch build. I don't know if they've fixed this in later versions of VS.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!