Qt World Summit: Submit your Presentation

_ITERATOR_DEBUG_LEVEL error for libraries

  • I am having a Qt app with a few C++ libraries all built using Qmake & QtCreator on windows. I am using VisualStudio 2015 community edition which provides the C++ compiler to Qt on windows. By selecting debug option in bottom left corner, I generated debug libs out of all my library projects. But when I build my app in debug mode now, it results in following error.
    LNK2038:mismatch detected for _ITERATOR_DEBUG_LEVEL value 0 doesnt match value 2 in main.obj

  • Lifetime Qt Champion

    IIRC you can use TARGET = $$qtLibraryTarget(MyLib)

  • Lifetime Qt Champion


    AFAIK, it comes when you are mixing objects built for different type of builds. Did you clean everything before changing the build type ?

  • Yes I did. really strange. i just need the debug libs ONLY on windows so I am linking them on myapp.pro like this

    LIBS += -L$$MyLib_build_location -lMyLib
    Debug:win32: LIBS += -L$$MyLib_build_location -lMyLibD
    INCLUDEPATH += $$MyLib_include_location/
    DEPENDPATH += $$MyLib_include_location/
    unix:PRE_TARGETDEPS += $$MyLib_build_location/MyLib.a
    win32:PRE_TARGETDEPS += $$MyLib_build_location/MyLib.lib

    Is above not correct ? Can you pls provide a sample ?

  • @SGaist Qt is not appending a D to the debug version of of lib. It names MyLib.lib even in debug version whereas I am expecting it to be MyLibD.lib. In pro file of my MyLib I have defined the following

    TARGET = MyLib

    Is it because of above line of code in MyLib.lib. Is there some way I can ensure that debug version of my lib gets a name with D appended to it ?

  • Lifetime Qt Champion

    IIRC you can use TARGET = $$qtLibraryTarget(MyLib)

  • @SGaist Thanks a lot. That solves my problem.

Log in to reply