我在基于 Qt 5.11.2(MSVC 2015,32 位)的 QtCreator 4.7.2 中生成发布文件夹时遇到了一些麻烦。我的程序在调试版本中运行得很好,但是当我将构建更改为发布版本时,出现编译器错误。
我在我的应用程序中使用 QCustomPlot 库,但不知何故在发布版本中它不喜欢
integerPart > 0 ? QString::number(integerPart)+QLatin1String(" ") : QLatin1String("")
这给了我一个C2446: ':': no conversion from 'QLatin1String' to 'QStringBuilder'
所以我用
integerPart > 0 ? "" : ""
所以编译器不再抛出错误,但现在我得到一个LNK1158: cannot run 'rc.exe'
我试图清理构建并运行 qmake,但链接器错误并没有消失。有什么想法会导致这个问题吗?我只从调试切换到发布。
编辑:
#-------------------------------------------------
#
# Project created by QtCreator 2018-11-09T09:59:59
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
TARGET = PlotterApp
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
DEFINES += QT_USE_QSTRINGBUILDER
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += c++11
QT += serialport
SOURCES += \
main.cpp \
mainwindow.cpp \
serialporthandler.cpp \
qcustomplot.cpp \
parameterobject.cpp
HEADERS += \
mainwindow.h \
serialporthandler.h \
qcustomplot.h \
parameterobject.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
转到此文件夹
C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86
并将rc.exe和rcdll.dll复制到以下文件夹
X64
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64
X86
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句