Build error in Qt Creator in release but not in debug [SOLVED]
-
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.
-
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 } }
-
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.