Unsolved Unable to run application in debug mode
-
I am developing a multiplatform application and in Windows I'm using MSVC2015 with Qt5.6
My application is running just fine in MacOS and Linux both in Debug and Release Modes. However, on Windows I cannot run my application in Debug Mode.
When I start the debugger I get an error in the following line.
I have a class that has a static map initialized like thisstatic const QMap<QString, PropertyInfo> S_PROPERTY_INFO_MAP = { {"objectName", PointCloudData::tr("Objeto")},
If I leave the QMap empty I get the error
QWidget: Must construct a QApplication before a QWidget
But why my application is running in release mode without problems?
-
Hi, I'm guessing the reason your app works in Release mode and on the other platforms is just luck.
When doing stuff like ::tr("Hello") in static data initialization, i.e. before the QApplication is constructed in your main.cpp, what code gets run in what order is undefined in C++ and Qt is kinda confused before that QApplication is up and running. You could try filling the QMap in a for loop instead.