我正在尝试使用Windows 10
和Qt5.12
建立一个项目。小程序正在使用可用的smtp
协议here。我可以确认我的Windows上具有OpenSSL 1.1.1c,2019年5月28日。在我的Ubuntu 19.04上,相同的程序可以正常编译并正常运行,但不能在Windows上运行。
我将我的存储库git clone
放入Windows
,然后成功this post,并且程序正确构建。
问题是当我运行它时,它正在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
存储到我的Windows
中,添加了缺少的SMTP_BUILD
,但是我无法对打印屏幕上的窗口正在询问的可执行文件进行优化。最后一步,我缺少什么?
非常感谢您指出正确的方向。
如您的.pro图像所示,您正在使用TEMPLATE = lib
,其目的是创建一个库,该库的产品为.dll,.so等,而不是.exe。
如果要生成可执行文件,则必须使用:
TEMPLATE = app
加号:
为了使在您的项目中包含库更容易,我创建了this project,其目的是提供一个.pri文件,该链接易于使用.pro链接到任何项目。为此,您必须执行以下步骤:
include(/path/of/SMTPEmail.pri)
添加到您的.pro#include <SmtpMime>