Problème : Core avec librairie Qt
Bonjour à tous,
Je suis en train d'apprendre à utiliser la librairie Qt pour la création d'interfaces d'utilisateur.
J'ai généré le code suivant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#include <QApplication>
#include <QPushButton>
#include<QGridLayout>
#include<QLabel>
int main(int argc, char *argv[])
{
//Q_INIT_RESOURCE(application);
QCoreApplication app(argc, argv);
//qDebug("Hello from Qt 4!");
QWidget aWindow;
QGridLayout * aMainLayout = new QGridLayout(&aWindow);
QLabel * aLabel1 = new QLabel("One");
QLabel * aLabel2 = new QLabel("Two");
aMainLayout->addWidget(aLabel1,0,0);
aMainLayout->addWidget(aLabel2,0,1);
aWindow.show();
/**
QPushButton aButton("Quit");
aButton.show();
QObject::connect(&aButton, SIGNAL(clicked()), &app, SLOT(quit()));
*/
return app.exec();
} |
Le code compile parfaitement mais je me prends un core.
L'erreur est le suivant:
QWidget: Cannot create a QWidget when no GUI is being used
Aborted (core dumped)
Est-ce que quelqu'un peut me dire de quoi cela s'agit ?
Comment le resoudre ?
Merci d'avance !!