I have a project using QtDesigner with VS10 win7 64bits and it works fine in debug mode but in release, it pop ups
Must construct a QApplication before a QPaintDevice
did I miss something during the installation, do I need to re install Qt??
thank you for your help!!
Neither nor. You just need to fix your code ;-)
It's hard to say exactly without seeing your code. But make sure you create a QApplication object first before you do anything with Qt GUI widgets. Also try to find out where exactly in your code the warning/error is triggered.
From the docs:
bq. For any GUI application using Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any given time. For non-GUI Qt applications, use QCoreApplication instead, as it does not depend on the QtGui library.
bq. Since the QApplication object does so much initialization, it must be created before any other objects related to the user interface are created. QApplication also deals with common command line arguments. Hence, it is usually a good idea to create it before any interpretation or modification of argv is done in the application itself.
thanks for your quick reply!
my code is simple as:
int main(int argc, char *argv)
QApplication a(argc, argv);
As I said, it works fine on debug mode but on release, it stops at the following line:
QtCored4.dll!qt_message_output(QtMsgType msgType, const char * buf) Line 2311 C++
thx for your help
Your code looks okay, so far. Try to make a clean re-build.
But: You don't have any statically initialized global variables, do you?
Static initializes are run before main(), that's why I ask...
Even with clean mode the problem still persists
There is some global variables in tomoregistration.h:
@extern std::vector<std::vector<double>> sourceLandmark;
extern std::vector<std::vector<double>> targetLandmark;@
and im my tomoregistration.cpp file I have
That should be fine.
Just don't make any global variables with Qt Widgets, as they would be created before the main() function and thus before QApplication is created.
Again, I think you should track down where exactly in the program the error is triggered. E.g., step through your program line by line and find out the last line (command) that is executed before the error/warning appears...