Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Build error in Qt Creator in release but not in debug [SOLVED]

Build error in Qt Creator in release but not in debug [SOLVED]

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Linhares
    wrote on last edited by Linhares
    #1

    I'm working with Qt 5.15.2 in Qt Creator 6.0.2. I have a program that uses a .lib file which was built in both debug (_ITERATOR_DEBUG_LEVEL = 0) and release (_ITERATOR_DEBUG_LEVEL = 2) versions. I can build the debug version of my program with no problems, but when I try to build the release I get this error:

    LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in button.obj

    I also get

    LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DyamicRelease' in button.obj

    I understand my .obj files are somehow linked to ITERATOR_DEBUG_LEVEL = 0 and MDd, but I don't know how to change these parameters on the Qt project.

    Here's the .pro file:

    QT += core gui qml
    QT += serialport
    QT += multimedia
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    CONFIG += c++11
    CONFIG += console
    
    
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
    
    SOURCES += \
        button.cpp \
        checkbox.cpp \
        combolist.cpp \
        controlpanel.cpp \
        expressionevaluator.cpp \
        filter.cpp \
        globals.cpp \
        logicaloperator.cpp \
        main.cpp \
        mainwindow.cpp \
        neurobit.cpp \
        numericdisplay.cpp \
        oscilloscope.cpp \
        pnwiz.cpp \
        pnwiz_devicethread.cpp \
        pnwiz_ui.cpp \
        pnwizconfigwindow.cpp \
        pnwizconnectionmenu.cpp \
        pnwizelectrocapmenu.cpp \
        score.cpp \
        shadow.cpp \
        shadowpanel.cpp \
        shadowvolume.cpp \
        shadowwindow.cpp \
        threshold.cpp \
        thresholdbar.cpp \
        timetransform.cpp \
        variablefilter.cpp
    
    HEADERS += \
        button.h \
        checkbox.h \
        combolist.h \
        controlpanel.h \
        expressionevaluator.h \
        filter.h \
        globals.h \
        logicaloperator.h \
        mainwindow.h \
        neurobit.h \
        numericdisplay.h \
        oscilloscope.h \
        pnwiz.h \
        pnwiz_devicethread.h \
        pnwiz_ui.h \
        pnwizconfigwindow.h \
        pnwizconnectionmenu.h \
        pnwizelectrocapmenu.h \
        score.h \
        shadow.h \
        shadowpanel.h \
        shadowvolume.h \
        shadowwindow.h \
        threshold.h \
        thresholdbar.h \
        timetransform.h \
        variablefilter.h
    
    FORMS += \
        button.ui \
        checkbox.ui \
        combolist.ui \
        controlpanel.ui \
        mainwindow.ui \
        numericdisplay.ui \
        pnwiz_ui.ui \
        pnwizconfigwindow.ui \
        pnwizconnectionmenu.ui \
        pnwizelectrocapmenu.ui \
        shadowpanel.ui \
        shadowwindow.ui \
        threshold.ui \
        thresholdbar.ui \
        variablefilter.ui
    
    # Default rules for deployment.
    qnx: target.path = /tmp/$${TARGET}/bin
    else: unix:!android: target.path = /opt/$${TARGET}/bin
    !isEmpty(target.path): INSTALLS += target
    
    RESOURCES += \
        Images.qrc \
        Sounds.qrc
    
    LIBS += -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32
    
    
    unix|win32: LIBS += -L$$PWD/../Filtros01/Filtros01-Output/Products/x64Debug/ -lDSPFilters
    
    INCLUDEPATH += $$PWD/DSPFilters_original/include
    DEPENDPATH += $$PWD/DSPFilters_original/include
    

    And here's the qmake call:

    E:/Qt/5.15.2/msvc2019_64/bin/qmake.exe E:\C++\Qt\QWiz_4\QWiz_4.pro -spec win32-msvc "CONFIG+=qtquickcompiler" && E:/Qt/Tools/QtCreator/bin/jom/jom.exe qmake_all
    

    I appreciate it if anyone can give any help with this.

    C 1 Reply Last reply
    0
    • L Linhares

      I'm working with Qt 5.15.2 in Qt Creator 6.0.2. I have a program that uses a .lib file which was built in both debug (_ITERATOR_DEBUG_LEVEL = 0) and release (_ITERATOR_DEBUG_LEVEL = 2) versions. I can build the debug version of my program with no problems, but when I try to build the release I get this error:

      LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in button.obj

      I also get

      LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DyamicRelease' in button.obj

      I understand my .obj files are somehow linked to ITERATOR_DEBUG_LEVEL = 0 and MDd, but I don't know how to change these parameters on the Qt project.

      Here's the .pro file:

      QT += core gui qml
      QT += serialport
      QT += multimedia
      
      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
      
      CONFIG += c++11
      CONFIG += console
      
      
      #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000
      
      SOURCES += \
          button.cpp \
          checkbox.cpp \
          combolist.cpp \
          controlpanel.cpp \
          expressionevaluator.cpp \
          filter.cpp \
          globals.cpp \
          logicaloperator.cpp \
          main.cpp \
          mainwindow.cpp \
          neurobit.cpp \
          numericdisplay.cpp \
          oscilloscope.cpp \
          pnwiz.cpp \
          pnwiz_devicethread.cpp \
          pnwiz_ui.cpp \
          pnwizconfigwindow.cpp \
          pnwizconnectionmenu.cpp \
          pnwizelectrocapmenu.cpp \
          score.cpp \
          shadow.cpp \
          shadowpanel.cpp \
          shadowvolume.cpp \
          shadowwindow.cpp \
          threshold.cpp \
          thresholdbar.cpp \
          timetransform.cpp \
          variablefilter.cpp
      
      HEADERS += \
          button.h \
          checkbox.h \
          combolist.h \
          controlpanel.h \
          expressionevaluator.h \
          filter.h \
          globals.h \
          logicaloperator.h \
          mainwindow.h \
          neurobit.h \
          numericdisplay.h \
          oscilloscope.h \
          pnwiz.h \
          pnwiz_devicethread.h \
          pnwiz_ui.h \
          pnwizconfigwindow.h \
          pnwizconnectionmenu.h \
          pnwizelectrocapmenu.h \
          score.h \
          shadow.h \
          shadowpanel.h \
          shadowvolume.h \
          shadowwindow.h \
          threshold.h \
          thresholdbar.h \
          timetransform.h \
          variablefilter.h
      
      FORMS += \
          button.ui \
          checkbox.ui \
          combolist.ui \
          controlpanel.ui \
          mainwindow.ui \
          numericdisplay.ui \
          pnwiz_ui.ui \
          pnwizconfigwindow.ui \
          pnwizconnectionmenu.ui \
          pnwizelectrocapmenu.ui \
          shadowpanel.ui \
          shadowwindow.ui \
          threshold.ui \
          thresholdbar.ui \
          variablefilter.ui
      
      # Default rules for deployment.
      qnx: target.path = /tmp/$${TARGET}/bin
      else: unix:!android: target.path = /opt/$${TARGET}/bin
      !isEmpty(target.path): INSTALLS += target
      
      RESOURCES += \
          Images.qrc \
          Sounds.qrc
      
      LIBS += -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32
      
      
      unix|win32: LIBS += -L$$PWD/../Filtros01/Filtros01-Output/Products/x64Debug/ -lDSPFilters
      
      INCLUDEPATH += $$PWD/DSPFilters_original/include
      DEPENDPATH += $$PWD/DSPFilters_original/include
      

      And here's the qmake call:

      E:/Qt/5.15.2/msvc2019_64/bin/qmake.exe E:\C++\Qt\QWiz_4\QWiz_4.pro -spec win32-msvc "CONFIG+=qtquickcompiler" && E:/Qt/Tools/QtCreator/bin/jom/jom.exe qmake_all
      

      I appreciate it if anyone can give any help with this.

      C Offline
      C Offline
      ChrisW67
      wrote on last edited by
      #2

      This line:

      unix|win32: LIBS += -L$$PWD/../Filtros01/Filtros01-Output/Products/x64Debug/ -lDSPFilters
      

      unconditionally puts the debug version of the DSPFilters library in the path for the linker. When you link the release version of everything else to the debug version of the library you see the type of error you report.

      Something like this might work better (adjust the path for the release library as needed):

      unix|win32 {
        release {
          LIBS += -L$$PWD/../Filtros01/Filtros01-Output/Products/x64Release/ -lDSPFilters
        }
        debug {
          LIBS += -L$$PWD/../Filtros01/Filtros01-Output/Products/x64Debug/ -lDSPFilters
        }
      }
      1 Reply Last reply
      3
      • L Offline
        L Offline
        Linhares
        wrote on last edited by Linhares
        #3

        Thanks, @ChrisW67 . This solves the initial issue, but now I get a different error:

        LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in button.obj

        I think the solution is close, but I don't know how to proceed from here.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          Linhares
          wrote on last edited by
          #4

          Ok, I was able to solve it by releasing the library in MD mode. Now I can build in release mode. Thanks for the help!

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved