# error LNK2038: mismatch detected for '\_ITERATOR\_DEBUG\_LEVEL':

**URL:** https://discourse.itk.org/t/error-lnk2038-mismatch-detected-for-iterator-debug-level/1718
**Category:** Engineering
**Created:** [March 28, 2019, 9:32pm UTC](https://discourse.itk.org/t/error-lnk2038-mismatch-detected-for-iterator-debug-level/1718 "2019-03-28T21:32:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Gib](https://discourse.itk.org/user_avatar/discourse.itk.org/gib/32/4124_2.png) [@Gib](https://discourse.itk.org/u/Gib)
#### Post date: [March 28, 2019, 9:32pm UTC](https://discourse.itk.org/t/error-lnk2038-mismatch-detected-for-iterator-debug-level/1718/1 "2019-03-28T21:32:24Z")

</div>

error LNK2038: mismatch detected for ‘\_ITERATOR\_DEBUG\_LEVEL’: value ‘2’ doesn’t match value ‘0’ in compress.obj  
error LNK2038: mismatch detected for ‘RuntimeLibrary’: value ‘MDd\_DynamicDebug’ doesn’t match value ‘MD\_DynamicRelease’ in compress.obj

I get this more than 200 times building an ITK program (Release) on Win10, with VS11. I’m almost certain that I met and resolved this about a year ago, but I’ve forgotten the solution.  
The problem is that I have ITK\_DIR set to D:\ITK-VS11-x64, and in the project properties I see that the libraries being linked are like: D:\ITK-VS11-x64\lib\itksys-4.7.lib  
However the Release libraries are in: D:\ITK-VS11-x64\lib\release.

The relevant line in CMakeLists.txt is:  
TARGET\_LINK\_LIBRARIES(${PROJECTNAME} ${ITK\_LIBRARIES} )

How can I ensure that Visual Studio looks in the right place for the Release libraries?

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [March 29, 2019, 1:50pm UTC](https://discourse.itk.org/t/error-lnk2038-mismatch-detected-for-iterator-debug-level/1718/2 "2019-03-29T13:50:05Z")

</div>

Doing a clean/rebuild of your program is the first thing I would try, as that is the quickest. If it doesn’t help, you could try clean/rebuild of ITK. But that would be slow, and you might go straight for a clean build of ITK + a clean build of your program. And by clean build I mean starting from CMake configure in a new folder.

---

<div class="post-metadata">

### Author: ![Gib](https://discourse.itk.org/user_avatar/discourse.itk.org/gib/32/4124_2.png) [@Gib](https://discourse.itk.org/u/Gib)
#### Post date: [March 29, 2019, 7:13pm UTC](https://discourse.itk.org/t/error-lnk2038-mismatch-detected-for-iterator-debug-level/1718/3 "2019-03-29T19:13:37Z")

</div>

Hi Dzenan,  
I discovered that the libraries in D:\ITK-VS11-x64\lib were the Debug libraries, i.e. copies of the files in D:\ITK-VS11-x64\lib\debug. The simple fix was just to copy the Release libraries into D:\ITK-VS11-x64\lib. This issue is clearly connected to the Install, and maybe I did something wrong there. Both Debug and Release libraries were installed, but in their own subdirectories, where VS11 is not looking for them.  
Gib
