在QT创建者中构建错误,而不是在调试中构建错误

发布于 2025-01-29 05:12:43 字数 3231 浏览 4 评论 0原文

我正在使用QT创建者6.0.2中的QT 5.15.2。 我有一个程序,该程序使用了一个.lib文件,该文件均在debug(_iterator_debug_level = 0)和版本(_iterator_debug_level = 2)版本中构建。我可以毫无问题地构建程序的调试版本,但是当我尝试构建版本时,我会收到此错误:

lnk2038:检测到的不匹配为'_iterator_debug_level':value'2'在button.obj

中不匹配值'0'

我也得到

lnk2038:在“ runtimelibrary”中检测到的不匹配:值'mdd_dynamicdebug'在button.obj

我知道我的.obj文件以某种方式链接到iterator_debug_level = 0和mdd,但我不知道如何更改QT项目中的这些参数。

更新

以下是.pro文件:

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

这是qmake调用:

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

更新2

我尝试了evgene提出的解决方案,现在我收到了另一个错误消息:

lnk2038:在“ runtimelibrary”中检测到的不匹配:值'mt_staticrease'不匹配值'md_dynamicrelease'button.obj

更新3

好的,我能够通过以MD模式释放库来解决它。 现在我可以在发布模式下构建。感谢您的帮助!

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.

Update

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

Update 2

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?

Update 3

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

转瞬即逝 2025-02-05 05:12:43

问题在这里:

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

如您所见,您始终使用x64debug libs构建。
当然,尝试这样的东西

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

,请确保存在x64release路径,并在需要时替换。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文