Qt5 - Windows :Windows 找不到可执行文件
Qt5 - Windows :Windows cannot find executable
我正在尝试使用 Windows 10
和 Qt5.12
构建项目。小程序正在使用可用的 smtp
协议 here。我可以确认,在我的 Windows 上,我有 2019 年 5 月 28 日的 OpenSSL 1.1.1c。在我的 Ubuntu 19.04 上,完全相同的程序编译和 运行 像往常一样,但在 Windows.
我 git clone
我的存储库进入 Windows
,成功 并且程序构建正确。
问题 是当我 运行 它时,它 cannot find the executable
并且正在请求它,因为可以从下面的打印屏幕中看到:
这是我的 .pro
文件:
QT += quick quickcontrols2 concurrent network core gui
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
TARGET = SMTPEmail
DEFINES += SMTP_BUILD
# You can also make your code fail to compile if it uses 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
SOURCES += \
main.cpp \
progressbardialog.cpp \
robot.cpp \
robotmanager.cpp \
settings/emailaddress.cpp \
settings/mimeattachment.cpp \
settings/mimecontentformatter.cpp \
settings/mimefile.cpp \
settings/mimehtml.cpp \
settings/mimeinlinefile.cpp \
settings/mimemessage.cpp \
settings/mimemultipart.cpp \
settings/mimepart.cpp \
settings/mimetext.cpp \
settings/quotedprintable.cpp \
settings/smtpclient.cpp \
user.cpp \
usermanager.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
HEADERS += \
progressbardialog.h \
robot.h \
robotmanager.h \
settings/SmtpMime \
settings/emailaddress.h \
settings/mimeattachment.h \
settings/mimecontentformatter.h \
settings/mimefile.h \
settings/mimehtml.h \
settings/mimeinlinefile.h \
settings/mimemessage.h \
settings/mimemultipart.h \
settings/mimepart.h \
settings/mimetext.h \
settings/quotedprintable.h \
settings/smtpclient.h \
settings/smtpexports.h \
user.h \
usermanager.h
在我的桌面上,它自动创建了 build
文件夹,并认为可执行文件会在这里。下面我还附上了 build
文件夹内内容的打印屏幕:
最初这个项目是在 Ubuntu
上部署的,这没有给我带来任何问题。我 git clone
那个 repo 到我的 Windows
,添加了丢失的 SMTP_BUILD
但我无法确定打印屏幕中 window 要求的可执行文件。这最后一步我错过了什么?
非常感谢您指出正确的方向。
如您的 .pro 图像所示,您正在使用 TEMPLATE = lib
,其 objective 用于创建一个库,其产品是 .dll、.so 等,而不是 . exe.
如果要生成可执行文件,您必须使用:
TEMPLATE = app
加上:
为了更容易将库包含在您的项目中,我创建了 this project,其 objective 是为了提供一个 .pri,它很容易 link 到任何项目.pro.为此,您必须遵循以下步骤:
- 下载项目
- 将
include(/path/of/SMTPEmail.pri)
添加到您的 .pro
- 包括使用
#include <SmtpMime>
我正在尝试使用 Windows 10
和 Qt5.12
构建项目。小程序正在使用可用的 smtp
协议 here。我可以确认,在我的 Windows 上,我有 2019 年 5 月 28 日的 OpenSSL 1.1.1c。在我的 Ubuntu 19.04 上,完全相同的程序编译和 运行 像往常一样,但在 Windows.
我 git clone
我的存储库进入 Windows
,成功
问题 是当我 运行 它时,它 cannot find the executable
并且正在请求它,因为可以从下面的打印屏幕中看到:
这是我的 .pro
文件:
QT += quick quickcontrols2 concurrent network core gui
CONFIG += c++11
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
TARGET = SMTPEmail
DEFINES += SMTP_BUILD
# You can also make your code fail to compile if it uses 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
SOURCES += \
main.cpp \
progressbardialog.cpp \
robot.cpp \
robotmanager.cpp \
settings/emailaddress.cpp \
settings/mimeattachment.cpp \
settings/mimecontentformatter.cpp \
settings/mimefile.cpp \
settings/mimehtml.cpp \
settings/mimeinlinefile.cpp \
settings/mimemessage.cpp \
settings/mimemultipart.cpp \
settings/mimepart.cpp \
settings/mimetext.cpp \
settings/quotedprintable.cpp \
settings/smtpclient.cpp \
user.cpp \
usermanager.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
HEADERS += \
progressbardialog.h \
robot.h \
robotmanager.h \
settings/SmtpMime \
settings/emailaddress.h \
settings/mimeattachment.h \
settings/mimecontentformatter.h \
settings/mimefile.h \
settings/mimehtml.h \
settings/mimeinlinefile.h \
settings/mimemessage.h \
settings/mimemultipart.h \
settings/mimepart.h \
settings/mimetext.h \
settings/quotedprintable.h \
settings/smtpclient.h \
settings/smtpexports.h \
user.h \
usermanager.h
在我的桌面上,它自动创建了 build
文件夹,并认为可执行文件会在这里。下面我还附上了 build
文件夹内内容的打印屏幕:
最初这个项目是在 Ubuntu
上部署的,这没有给我带来任何问题。我 git clone
那个 repo 到我的 Windows
,添加了丢失的 SMTP_BUILD
但我无法确定打印屏幕中 window 要求的可执行文件。这最后一步我错过了什么?
非常感谢您指出正确的方向。
如您的 .pro 图像所示,您正在使用 TEMPLATE = lib
,其 objective 用于创建一个库,其产品是 .dll、.so 等,而不是 . exe.
如果要生成可执行文件,您必须使用:
TEMPLATE = app
加上:
为了更容易将库包含在您的项目中,我创建了 this project,其 objective 是为了提供一个 .pri,它很容易 link 到任何项目.pro.为此,您必须遵循以下步骤:
- 下载项目
- 将
include(/path/of/SMTPEmail.pri)
添加到您的 .pro - 包括使用
#include <SmtpMime>