【问题标题】:Qt5 - Windows: VCRUNTIME140D_APP.dll was not foundQt5 - Windows:未找到 VCRUNTIME140D_APP.dll
【发布时间】:2020-04-04 02:23:40
【问题描述】:

我即将在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) 我做了更多的研究,发现了thisthis postthis one。但是所有这些都没有帮助我弄清楚如何理解问题所在。

4) 我也尝试从上面第 2) 点的同一站点安装此版本vcruntime140d.dll,但结果仍然相同。缺少库VCRUNTIME140D_APP.dll was not found

最后我要注意的是:我下载并尝试了 vcruntime140_app.dll 然后 vcruntime140d.dll 但我找不到 vcruntime140d_app。 dll(如果存在)。

我不明白为什么,尽管库在那里,也可以在这里看到 C:\Users\me\OneDrive\Desktop\build-signalsQML-Desktop_Qt_5_12_0_MSVC2017_64bit-Debug\vcruntime140_app.dll 双击可执行文件仍然给出相同的错误。

感谢您指出解决此问题的正确方向。

【问题讨论】:

  • 评论不用于扩展讨论;这个对话是moved to chat
  • 从文件名来看,您似乎正在尝试部署调试版本(它无法正常工作,我认为这在法律上也是不允许的)。您是否尝试过发布版本?

标签: c++ windows qt dll qt5


【解决方案1】:

解决方案是将 QT 依赖项部署到应用程序文件夹。在尝试了很多之后,以下命令为我解决了这个问题。

C:\Qt\5.12.10\msvc2017_64\bin>windeployqt.exe 项目路径\发布

此命令将所有必需的 QT 依赖项复制到应用程序文件夹。

从以下链接获得提示: QT forum reference

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-03-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多