我将要在 Windows 10
上部署一个小应用程序。感谢 this post,我成功构建并运行了应用程序并创建了可执行文件.
我遇到的问题是突然间缺少了一个.dll
。具体来说,单击 .exe
以确保应用程序正常工作后出现的错误消息如下:
找不到 VCRUNTIME140D_APP.dll
在我的调试文件夹中,我创建了 .exe
并且不知道为什么要请求该库。
这是我的 .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
TEMPLATE = app
DEFINES += SMTP_BUILD
#win32:CONFIG += dll
#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 =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
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
到目前为止我做了什么
1) 为了解决最后一个问题,我研究并发现了 this useful post这也解释了主要区别。尽管需要注意的是此应用程序只能在桌面上运行。
2) 我找到了这个版本可以下载vcruntime140_app.dll我从中下载了丢失的库。解压缩并添加到我的调试文件夹中,也可以从下面的打印屏幕上看到:
之后,我构建并运行了该应用程序,但令人惊讶的是,尽管缺少 .dll
已手动添加到调试文件夹中,但我还是收到了完全相同的错误。
3) 我做了更多研究并发现了 this , this post还有this one .但所有这些并没有帮助我弄清楚如何理解问题所在。
4) 我也试过安装这个版本vcruntime140d.dll来自上面第 2) 点的同一站点,但结果仍然相同。缺少库 找不到 VCRUNTIME140D_APP.dll
我必须注意的最后一件事是:我下载并尝试了 vcruntime140_app.dll 然后 vcruntime140d.dll 但我找不到 vcruntime140d_app。 dll 如果它存在。
我不明白为什么,尽管库在那里也可以在这里看到> 双击可执行文件仍然给出相同的错误。
感谢您为解决这个问题指明了正确的方向。
最佳答案
解决方案是将 QT 依赖项部署到应用程序文件夹。尝试了很多之后,以下命令为我解决了这个问题。
C:\Qt\5.12.10\msvc2017_64\bin>windeployqt.exe 项目路径\Release
此命令将所有必需的 QT 依赖项复制到应用程序文件夹。
从以下链接得到提示: QT forum reference
关于c++ - Qt5 - 未找到 Windows : VCRUNTIME140D_APP. dll,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59275022/