在基于Qt 5.11.2(MSVC 2015,32位)的QtCreator 4.7.2中生成发行文件夹时,我有些麻烦。我的程序在调试版本中运行得很好,但是当我将构建版本更改为发行版本时,会出现编译器错误。
我在应用程序内使用QCustomPlot库,并且在发行版中以某种方式不喜欢
integerPart > 0 ? QString::number(integerPart)+QLatin1String(" ") : QLatin1String("")
这使我得到一个 C2446:':':没有从'QLatin1String'到'QStringBuilder'的转换
所以我将测试行替换为
integerPart > 0 ? "" : ""
,因此编译器不再抛出任何错误,但是现在我得到一个 LNK1158:无法运行'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
答案 0 :(得分:1)
转到此文件夹
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