error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL':


(Gib Bogle) #1

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?


(Dženan Zukić) #2

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.


(Gib Bogle) #3

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