Qt5-Windows:Windows无法找到可执行文件

我正在尝试使用Windows 10Qt5.12构建项目。小程序正在使用here可用的smtp协议。我可以确认我的Windows上具有OpenSSL 1.1.1c(2019年5月28日)。在我的Ubuntu 19.04上,相同的程序可以正常编译并运行,但不能在Windows上运行。

我将存储库git clone Windows this post之后{{3}},并且程序正确构建。

问题是,当我运行它时,它cannot find the executable并在要求它,因为可以从下面的打印屏幕中看到它:

Qt5-Windows:Windows无法找到可执行文件

这是我的.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文件夹中内容的打印屏幕:

Qt5-Windows:Windows无法找到可执行文件

最初,此项目已部署在Ubuntu上,这丝毫没有问题。我git clone回购了我的Windows,添加了丢失的SMTP_BUILD,但是我无法对打印屏幕上的窗口正在询问的可执行文件进行优化。最后一步我缺少什么?

非常感谢您指出正确的方向。

numen1234 回答:Qt5-Windows:Windows无法找到可执行文件

如您的.pro图像所示,您正在使用TEMPLATE = lib,其目的是创建一个库,该库的产品为.dll,.so等,而不是.exe。

如果要生成可执行文件,则必须使用:

TEMPLATE = app

加号:

为了更轻松地将库包含在您的项目中,我创建了this project,其目的是提供一个.pri文件,该链接易于使用.pro链接到任何项目。为此,您必须执行以下步骤:

  • 下载项目
  • include(/path/of/SMTPEmail.pri)添加到您的.pro
  • 包括使用#include <SmtpMime>
本文链接:https://www.f2er.com/2947750.html

大家都在问