Qt / Qt Creator - the program terminated unexpectedly. <program path> crashed

I am a little new to C ++ and Qt 5.2.1. I am really learning how to use Qt. To make this as simple as possible, I am using Qt Creator 3.0.1.

I wrote this little piece of code in the main.cpp file of my project:

#include <QApplication>
#include <QPushButton>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QPushButton bouton("Hello !");
    bouton.show();

    return app.exec();

}

And the .pro file (default):

SOURCES += \
    main.cpp

I tried to start it, then I had the problem "QApplication: there is no such file or directory."

Then I added "QT + = widgets" to the .pro file (full file):

SOURCES += \
    main.cpp
QT += widgets

And now I get:

Starting <path to .exe>... 
The program has unexpectedly finished.
<path to .exe> crashed

Please tell me how to make it work. Thanks for reading and for your help.

(OS: Windows 7, debugging: Qt 5.2.1 MinGW 32bit desktop)

Compile output:

16:06:54: Running steps for project test...
16:06:54: Configuration unchanged, skipping qmake step.
16:06:54: Starting: "C:\Qt\Tools\mingw48_32\bin\mingw32-make.exe" 
C:/Qt/Tools/mingw48_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Users/PLD/Documents/PLD/Projets Codages/Qt/Qt/build-test-Desktop_Qt_5_2_1_MinGW_32bit-Debug'
mingw32-make[1]: Nothing to be done for 'first'.
mingw32-make[1]: Leaving directory 'C:/Users/PLD/Documents/PLD/Projets Codages/Qt/Qt/build-test-Desktop_Qt_5_2_1_MinGW_32bit-Debug'
16:06:55: The process "C:\Qt\Tools\mingw48_32\bin\mingw32-make.exe" exited normally.
16:06:55: Elapsed time: 00:01.

Application Output:

Starting C:\Users\PLD\Documents\PLD\Projets Codages\Qt\Qt\build-test-Desktop_Qt_5_2_1_MinGW_32bit-Debug\debug\test.exe...
The program has unexpectedly finished.
C:\Users\PLD\Documents\PLD\Projets Codages\Qt\Qt\build-test-Desktop_Qt_5_2_1_MinGW_32bit-Debug\debug\test.exe crashed
+3
2

, Qt5. , , Windows.

- Qt4, .

+1

. , , DLL (, Debug vs Release builds MSVC vs MinGW). depend.exe .exe , .

+1

All Articles