简体   繁体   中英

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

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();                                                          
}  

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM