I don't catch exception in Qt
Unsolved
General and Desktop
-
I've encountered a big surprise for me.
My program doesn't catch any exception (in particully in main function ) when qt libraries have been included.
I googled this problem and didn't find an answer.
Please explain me:- Why this happens ?
- How to bypass this ? I use a combination of libraries in software development (stl, boost, opencv) and i cant develop software, applying ONLY QT.
Details:
QT version - 5.2
Mingw 4.8 and 6.02
.pro file
#------------------------------------------------- # # Project created by QtCreator 2018-04-28T23:53:47 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = qt_eception TEMPLATE = app SOURCES += main.cpp HEADERS += FORMS +=
main.cpp
#include <QApplication> #undef main int main(int argc, char *argv[]) { try { QApplication a(argc, argv); throw "ex"; } catch(...) { // Do Nothing } return 0; }
![alt text]( image url)
-
Hi
Qt should not have any effect your your ability to use exceptions.
Tried your sample on win 10 , vs 2015 compiler and it works.