I've read a dozen posts on this topic from several forums, and nothing has seemed to help me. My program was running fine, until I switched some functions around from one class to another to cut down on memory waste-age. Now I get
QWidget: Must construct a QApplication before a QPaintDevice
I dont think I have any static objects, or at least, I'm not entirely sure what a static object is, so I doubt that I'd inadvertently created one. My main looks like:
int main(int argc, char ** argv)
{
MainWindowImpl win;
win.show();
app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
return app.exec();
}
int main(int argc, char ** argv)
{
QApplication app( argc, argv );
MainWindowImpl win;
win.show();
app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
return app.exec();
}
To copy to clipboard, switch view to plain text mode
So the first thing I do is create a QApplication, but the error message seems to come even before main() is reached. I ran Valgrind, after reading about another person with the same problem.. it returned a lot of information, but I couldnt make much sense of any of it.
I'd really appreciate some assistance in figuring this out, as this is a problem I've run into several times in the past, and I've always just had to delete portions of code until it started working again, which is a considerable waste of time and effort.
Thank you for any advice you can give.
Bookmarks