无法使用 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 (将#修改为@)