18

We are using a library by another vendor, which apparently was compiled with the wrong flags, namely _ITERATOR_DEBUG_LEVEL = 0 in 32bit-Debug-mode. While I have already filed a bug report with them, I need an intermediate solution. We do not use stl ourselves, so I am free to change this flag for the subproject that uses said library. But I cannot figure out how to do so. What I tried an didn't work:

/D_ITERATOR_DEBUG_LEVEL=0
> LINK : warning LNK4044: unrecognized option '/D_ITERATOR_DEBUG_LEVEL=0'; ignored 

#define _ITERATOR_DEBUG_LEVEL 0
> Nothing happens

What's the proper syntax or option to get the project to compile without checked iterators?

Kajetan Abt
  • 1,505
  • 3
  • 15
  • 28

2 Answers2

33

Found the solution.

Project Pages / Configuration Properties / C,C++ / Preprocessor / Preprocessor Definitions.

Add "_ITERATOR_DEBUG_LEVEL=0" in there worked.

Kajetan Abt
  • 1,505
  • 3
  • 15
  • 28
  • I have just carried out the suggestion above. I have 2 projects, one is a static library linked to the other. Each started as a 2008 Express project. The library fully automatically converted to 2010 Express, the other was inserted into a new 2010 project as existing files. I had to make various config and code changes to get the latter project to build under debug using 2010 Express. I have added _ITERATOR_DEBUG_LEVEL=0 to the preprocessor macros under Release for both exe and static library. It made no difference. –  Apr 09 '13 at 23:15
  • Just to clarify on user22636958's comment, the way the error message reads, it makes me think I have to change the wrong project by adding `_ITERATOR_DEBUG_LEVEL`. I changed the other one and it worked for me. :-) – kmort Feb 23 '16 at 14:10
  • Just to add to the answer. In the Debug menu click the Base Properties and expand the Configuration Properties. – Andreas May 17 '18 at 07:41
6

Just as additional information : Project Pages / Configuration Properties / C,C++ / Preprocessor / Preprocessor Definitions and set the preprocessor macro _ITERATOR_DEBUG_LEVEL to one of the following depending on the target :

_ITERATOR_DEBUG_LEVEL = 0 // disabled (for release builds)
_ITERATOR_DEBUG_LEVEL = 1 // enabled (if _SECURE_SCL is defined)
_ITERATOR_DEBUG_LEVEL = 2 // enabled (for debug builds)
Vtik
  • 3,073
  • 2
  • 23
  • 38