If I write
try {
throw std::exception("Exception");
} catch (std::exception& ex) {
qDebug("Game Over");
}
inside my main function (or anywhere else), my Qt application crashes. This effect has been described (5 years ago) in Exception handling doesn't work with Qt on Windows.
The original poster apparently solved the problem by reconfiguring and rebuilding the Qt SDK himself (explicitly enabling -exceptions
), but I have a hard time believing that all Qt binaries are shipped with exceptions turned off and that everyone using exceptions must do this.
Could anyone point me to the place where this is documented, tell me whether this is true at all or what I'm doing wrong here?
I'm now on Qt 5.4.2 with MSVC2013, Win 7 (downloaded qt-opensource-windows-x86-msvc2013_opengl-5.4.2.exe from here).
You're not doing anything wrong. Since Qt doesn't use exceptions, it'd be unnecessary overhead to have them enabled in the default Qt builds. Hence, on platforms that allow the exceptions to be disabled, they do in fact get disabled.
Generally speaking, you really need to compile Qt yourself. The prebuilt binaries are fine for exploration and student use, but if you're serious about using it in your product, or you need non-default configuration, you absolutely have to compile it yourself with the flags that you need.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With