Ben
Ben

Reputation: 61

Using QT; QWidget: Must construct a QApplication before a QWidget

I am using vtk QT, i've installed VTK, PCL libraries well, after run the project the realese mode; i found the following error. QWidget: Must construct a QApplication before a QWidget

Upvotes: 1

Views: 357

Answers (1)

László Papp
László Papp

Reputation: 53173

As the error message says, you will need to create a QApplication before you can instantiate and use a QWidget. For example:

#include <QApplication>
#include <QDialog>                                                        
                                                                                                                                                       
int main(int argc, char *argv[])                                                
{                                                                               
    QApplication app(argc, argv);                                               
    QDialog dialog;                                                              
    dialog.setModal(true);                                                      
    dialog.show();                                                              
    return app.exec();                                                          
}  

Upvotes: 1

Related Questions