微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法使用 Qt 运行“hello world”控制台应用程序

如何解决无法使用 Qt 运行“hello world”控制台应用程序

我正在使用 Qt Creator 5.12.11(64 位)构建程序。

我只想用 Qt 构建一个简单的“hello world”控制台应用程序,但在点击 RUN 按钮后它只是构建,但它没有运行程序所以我找到了“hello_world.exe”文件并尝试运行它,但我收到一条消息说

“由于未找到 Qt5Cored.dll,代码执行无法继续。 重新安装程序可能会解决此问题。”

所以我复制并粘贴了那个 DLL 文件,最后它起作用了

如何永远解决这类问题?

我使用 Windows 10 (✖64)

我已经在 C:\Qt 安装了 qt5.12.11

这是我的配置文件和源文件

另外,我是 Qt 的新手。

QT -= gui

CONfig += c++11 console
CONfig -= app_bundle

# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so,uncomment the following line.
#DEFInes += QT_disABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated `before Qt 6.0.0`

SOURCES += \
        main.cpp

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

和源文件

#include <QCoreApplication>
#include <iostream>
using namespace std;
int main(int argc,char *argv[])
{
    QCoreApplication a(argc,argv);

    cout<<"Hello";

    return a.exec();
}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。