Solved Can not understand the origin of an exeption.
-
When I press Run I get
error: An exception was triggered:
Exception at 0x6b78f704, code: 0xc0000602: , flags=0x0.
But I see now errors in the code.
How can I understand what's going on?It worked good, I added some code - the exception was generated, I removed the code but the exception stays.
OK. I found the problem
added
static QMessageBox msgBox; in cpp file
and then in a function I use it
msgBox.setText("Unable to open the sys motor param file");
msgBox.exec();It crashes at static QMessageBox msgBox - so I should create a new instance of QMessageBox in every function?
-
Hi,
Don't create static QObject based objects. They need to have at least a QCoreApplication instance so the Qt internals are setup properly.
By the way, why do you want a static QMessageBox.
-
@SGaist said in Can not understand the origin of an exeption.:
Hi,
Don't create static QObject based objects. They need to have at least a QCoreApplication instance so the Qt internals are setup properly.
By the way, why do you want a static QMessageBox.
I use it in several functions in the file. So instead of create QMessageBox every time in a function I'd create it once. I guess I was wrong.
-
If this is in the context of a class, you can make it a member variable.
Otherwise, if you show the same message each time, make that a function that you call from the several places you need.