19

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?

1
  • 3
    /D is an option for the compiler and you gave it to the linker Commented Jan 20, 2016 at 9:37

3 Answers 3

33

Found the solution.

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

Add "_ITERATOR_DEBUG_LEVEL=0" in there worked.

Sign up to request clarification or add additional context in comments.

3 Comments

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.
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. :-)
Just to add to the answer. In the Debug menu click the Base Properties and expand the Configuration Properties.
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)

Comments

0

This article from Microsoft helped me, to solve the issue:

https://learn.microsoft.com/cpp/standard-library/iterator-debug-level

There is a compiler switch to set the value in Visual Studio 2022:

/D_ITERATOR_DEBUG_LEVEL=0

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.