dimanche 1 août 2021

Can NOT run a "hello world" console application with Qt

I'm building a program Using Qt Creator 5.12.11 (64 bit).

I just wanna build a simple "hello world" console app program with Qt but after hitting the RUN button it just builds, but it doesn't run the program so I found the "hello_world.exe" file and try to run it but I get a message that says "The code execution cannot proceed because Qt5Cored.dll was not found. Reinstalling the program may fix this problem."

So I copied and pasted that DLL file and finally it worked but

HOW solve this type of problem forever?

I use windows 10 (✖64) I've installed Qt5.12.11 at C:\Qt and this is my config file and source file also, I'm a newbie in 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;

and source file

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    cout<<"Hello";

    return a.exec();
}

Aucun commentaire:

Enregistrer un commentaire