I have read a lot of solutions to my problem but none helped. I tried clean, rebuild. Reinstalled visual 2010 and change from professional to ultimate. But still I dont know
In VS2010 iterator debug level defaults to 2 in debug and is disabled in release. One of the dlls you are using probably has iterator debugging turned off in debug either because it was built in an older version of visual studio or they explicitly added the defines to the project.
Search for _ITERATOR_DEBUG_LEVEL
and _SECURE_SCL
remove them or set them appropriately in all projects and sources and rebuild everything.
_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)
In short you are probably mixing release and debug dlls. Don't linked release dlls in debug or vice versa!
I had similar problem, but the wrong setting was in the extern .lib file from which I did not have sources. If you do not have the source files, the simplest workaround is to just change the content of the .lib file.
Open the .lib file in an editor (I used PSPad, bud Windows notepad is also possible) and replace all occurences of _ITERATOR_DEBUG_LEVEL=2 to _ITERATOR_DEBUG_LEVEL=0
I also had this issue and it arose because I re-made the project and then forgot to re-link it by reference in a dependent project.
Thus it was linking by reference to the old project instead of the new one.
It is important to know that there is a bug in re-adding a previously linked project by reference. You've got to manually delete the reference in the vcxproj and only then can you re-add it. This is a known issue in Visual studio according to msdn.
Last chance (if other ways don't work): define _ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH macro in all projects. It will disable "#pragma detect_mismatch" feature which is used in CRT headers.
I had the same problem today (VS2010), I built Release | Win32, then tried to build Debug | Win32, and got this message.
I tried cleaning Debug | Win32 but the error still persisted. I then cleaned Release | Win32, then cleaned Debug | Win32, and then it built fine.
In my case, for both Debug and Release, the solution was to clean then rebuild entire solution.
Edit: true in my case also (VS2017) step1: clean the project. step2: change configuration mode(from debug to release or vice versa). step3: clean the project. step4: build in the required configuration mode.
PS: to change config mode, find config settings under build menu