Hello
'am working in qt creator but have problem running my code.
It compiles alright but never executes.
And also gives the following message at the output pane 'exited at code -1073741819'
Please help me out

Clearly it is running since it "exited" just not in the way you intended.

Build and run in debug mode, if you are getting some sort of exception it should stop you where the code is going wrong. Alternitively step through the code in the debugger so you can locate by hand where it fails.

Now this piece of code compiles but GUI doesn't show up.
I really don't understand what's going on.
HELP ME PLEASE

#include<QtGui>

class myApp: public QMainWindow
{
    Q_OBJECT

public:
    myApp(QWidget *parent = 0);
    ~myApp(){delete this;};
    QPushButton *quitbutton;

private:
    QLabel *centralWid;
    QGridLayout *layout;
};


//main.cpp
#include "myApp.h"
myApp::myApp(QWidget *parent):QMainWindow(parent)
{

    centralWid = new QLabel(this);
    quitbutton = new QPushButton("Close");

    layout->addWidget(quitbutton,0,0);
    centralWid->setLayout(layout);
    this->setCentralWidget(centralWid);

}


int main(int argc, char *argv[])
{
QApplication app(argc, argv);
myApp *window = new myApp;

window->show();
return app.exec();
}

You never allocate any memory for layout, you are dereferencing and invalid pointer.

Wow! thank you very much .
This code is actually part of a larger project and has taken me almost a week
to get this solution.
Never realized it though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.