PDA

View Full Version : problem running and debugging using qt under windows



mastupristi
2nd February 2017, 19:28
Hi,
I have downloaded boundle windows package including qt 5.6.2, qt creator 4.0.3 and MingW 4.9.2 (qt-opensource-windows-x86-mingw492-5.6.2.exe (http://download.qt.io/official_releases/qt/5.6/5.6.2/qt-opensource-windows-x86-mingw492-5.6.2.exe))
The I started a simple qt application

dialog.cpp

#include "dialog.h"
#include "ui_dialog.h"

Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
}

Dialog::~Dialog()
{
delete ui;
}


dialog.h

#ifndef DIALOG_H
#define DIALOG_H

#include <QDialog>

namespace Ui {
class Dialog;
}

class Dialog : public QDialog
{
Q_OBJECT

public:
explicit Dialog(QWidget *parent = 0);
~Dialog();

private:
Ui::Dialog *ui;
};

#endif // DIALOG_H


main.cpp

#include "dialog.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Dialog w;
w.show();

return a.exec();
}


dialog.ui

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="pushButton">
<property name="text">
<string>PushButton</string>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11"/>
<resources/>
<connections/>
</ui>


it compiles, but when I try to Run it fails with this message:

Starting C:\Documents and Settings\massimiliano\progs\build-test-Desktop_Qt_5_6_2_MinGW_32bit-Debug\debug\test.exe...
The program has unexpectedly finished.
C:\Documents and Settings\massimiliano\progs\build-test-Desktop_Qt_5_6_2_MinGW_32bit-Debug\debug\test.exe crashed.

and when I try to debug I have this error:
12321

What is wrong with my setup?

best regards
max