Qt Creator Debug 有效但无法编译 release

Qt Creator Debug works but release cannot be compiled

我在基于 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: cannot 运行 '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\bin.0.17763.0\x86

并复制rc.exercdll.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