0

I have a large C++ project (20 static libraries, 5 DLLs) and some sort of memory issue that I can't pinpoint. Printing to the CMD window is too unreliable and I go in circles, and I feel like running the project in debug mode is the only hope I have in identifying where this bug is.

However, I can't seem to build my project in debug mode because of the _ITERATOR_DEBUG_LEVEL error in VS.

The accepted solution seems to be to recompile everything at the same debug level. So I tried this and managed to compile all my DLLs (it was a huge can of worms) in the _ITERATOR_DEBUG_LEVEL=0 option.

But I'm still having the _ITERATOR_DEBUG_LEVEL error, I still can't compile my project in debug mode. EDIT The exact error is :

LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2'

It lists these files, where myProject is the project I am trying to compile. projectVRPNabc.o is from another project that was recompiled with _ITERATOR_DEBUG_LEVEL=0

projectVRPNabc.o
myproject123.o
myproject456.o
myproject789.o

Advice, help, please?

Community
  • 1
  • 1
rlb.usa
  • 14,942
  • 16
  • 80
  • 128
  • 1
    What is the exact error message, and what are the lines before and after it in the output log? In the question you link, the file `client.cpp` has a debug level of 0, and `rtpsession.cpp` was compiled with a debug level of 2. Which files are your problem files? – Mooing Duck Apr 30 '14 at 21:29
  • @MooingDuck I added the error, can you remove your downvote now so my question can get help from other people? Having a negative score significantly wards away others. – rlb.usa Apr 30 '14 at 21:43
  • Huh, why doesn't your message look like the other one? Can you put the 5ish lines before and after that error from the output window into the question? (press Alt+2 to see it if it's missing) (renaming folders and files is fine) – Mooing Duck Apr 30 '14 at 21:47
  • @MooingDuck No. I am in the middle of a long process right now and cannot recompile to retrieve the entire error message. Hours from now when the recompile is finished, I can, but that will be hours away, and by then my chance of getting an answer will be very low as questions either tend to get their answers immediately or not at all (with the exceptions of straggler answers weeks or months later). So when my question ends up not getting an answer, then what? The only option I will have is to re-ask. And the re-asking will get closed because it's a dupe of this one. Please, be kind. – rlb.usa Apr 30 '14 at 21:50
  • 1
    making a minor edit to the question, such as adding additional information, bumps it to the top of the "active" page, which should get people to view it. – Mooing Duck Apr 30 '14 at 22:06
  • @MooingDuck Thanks, it's been a while since I've been here. A bit rusty. Very helpful. Cheers! – rlb.usa Apr 30 '14 at 22:11
  • Can you copy/paste the actual error messages? Each instance of `LNK2038` will list two object files - in your case the one that has `_ITERATOR_DEBUG_LEVEL` value '0' and the one that has `_ITERATOR_DEBUG_LEVEL` value '2'. The ones that have `_ITERATOR_DEBUG_LEVEL` value '2' obviously have not been rebuilt with `_ITERATOR_DEBUG_LEVEL=0`. (Maybe you need to do a complete clean and rebuild, or maybe your project is pointing to a stale copy of some lib or object file). It might be helpful to know which of the files in your list has the value set to 0 and which have the value set to 2. – Michael Burr May 01 '14 at 05:11

2 Answers2

2

_ITERATOR_DEBUG_LEVEL error in visual studio

See the comment here.

According to one of the comments it may be due to an old lib in your dir.

Community
  • 1
  • 1
SJP
  • 1,330
  • 12
  • 21
  • Question specifically states that the exact answer you link to does not work – Mooing Duck Apr 30 '14 at 21:28
  • I was linking him to the comment specifically. The person asking the question said the solution did not work as well. He solved it with an old library – SJP Apr 30 '14 at 21:32
  • Oh. I replaced the link with one that actually links to the comment then, and clarified your wording. – Mooing Duck Apr 30 '14 at 21:36
0

There was indeed an issue where the DLL was not compiled with the necessary _ITERATOR_DEBUG_LEVEL in order for the project to compile.

To the naked eye, it would seem that the DLL was compiled under the proper settings in debug mode. This was a lie.

Instead, in the Configuration Manager, the project was set to compile as release mode. So pressing the button to compile when it said "Debug" would actually compile in release instead. The issue gets chalked up as bad user interface design. It also means that the toolbar is unreliable.

TL;DR : Visual Studio's toolbar was a lie.

Visual Studio 2010 Config Manager vs Config Toolbar

rlb.usa
  • 14,942
  • 16
  • 80
  • 128