Qt / Qt Creator - 程序意外完成。 <程序路径>坠毁 [英] Qt/Qt Creator - The program has unexpectedly finished. <program's path> crashed
问题描述
我对C ++和Qt 5.2.1有些新。我实际上学习如何使用Qt。为了做到尽可能简单,我使用的是Qt Creator 3.0.1。
I'm somewhat new to C++ and to Qt 5.2.1. I'm actually learning how to use Qt. To do it as easy as possible, I'm using Qt Creator 3.0.1.
我在main.cpp文件中写了一小段代码项目:
I've written 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();
}
并且.pro文件p>
And the .pro file (by default) :
SOURCES += \
main.cpp
我试图让它运行,然后我得到了问题QApplication:没有这样的文件或目录。
I tried to make it run, then I got the issue "QApplication : no such file or directory".
然后,我在.pro文件(完整文件)中添加了QT + = widgets:
Then, I added "QT += widgets" to the .pro file (full file) :
SOURCES += \
main.cpp
QT += widgets
现在我得到: p>
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.
(操作系统:Windows 7,Debug:Desktop Qt 5.2.1 MinGW 32bit)
(OS : Windows 7, Debug : Desktop Qt 5.2.1 MinGW 32bit)
编译输出:
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.
应用程序输出:
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
推荐答案
我已经看过网络,寻求如何安装Qt5。没有足够的教程,它是非常令人费解的,使其在Windows上正常工作。
I've look all over the web, seeking how to install Qt5. There's not enough tutorials on it and it's very puzzling to make it work properly on Windows.
我终于安装了Qt4,这是更稳定,更容易使其工作。
I have finally installed Qt4, which is more stable and easier to make it work.
这篇关于Qt / Qt Creator - 程序意外完成。 <程序路径>坠毁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!