繁体   English   中英

Qt Creator调试有效,但无法编译发行版

[英]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:无法运行“ 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.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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM