Exception handling doesn't work with Qt on Windows

后端 未结 2 2127
青春惊慌失措
青春惊慌失措 2021-02-08 12:02

I\'m facing strange problem. Namely, Qt somehow turns off exception handling in my program. I can\'t catch any exception, and when I throw an exception application crashes.

相关标签:
2条回答
  • 2021-02-08 12:11

    I've reconfigured and recompiled Qt with flag -exceptions:
    D:\Qt\2010.05\qt>mingw32-make confclean && configure -exceptions && mingw32-make
    and now everything is ok!

    Thanks all for help, especially to Nick D!

    Anyway, it's very strange that I had Qt build without this flag. I had downloaded Qt SDK in binary form from official site.

    0 讨论(0)
  • 2021-02-08 12:26

    It's no longer necessary to use the -exceptions flag with Qt. In Qt Creator 4 it's the default, and my Windows Qt app happily uses vast and extensive exception handling with no problems. Qt MSVC builds use the /EHsc compiler option, which turns normal exception handling on.

    0 讨论(0)
提交回复
热议问题