Reputation: 21
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 tried the solution proposed by Evgene and now I get a different error message:
LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in button.obj
Any ideas on how this can be corrected?
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!
Upvotes: 0
Views: 838
Reputation: 4010
The problem is here:
unix|win32: LIBS += -L$$PWD/../Filtros01/Filtros01-Output/Products/x64Debug/ -lDSPFilters
As you can see, you always use x64Debug
libs build.
Try something like this
CONFIG(debug, debug|release) {
unix|win32: LIBS += -L$$PWD/../Filtros01/Filtros01-Output/Products/x64Debug/
}
else {
unix|win32: LIBS += -L$$PWD/../Filtros01/Filtros01-Output/Products/x64Release/
}
unix|win32: LIBS += -lDSPFilters
Of course make sure the x64Release
path exists and replace it if needed.
Upvotes: 1