[SOLVED] Exception handling on Android
-
wrote on 23 Feb 2015, 12:38 last edited by
Hi, all.
I tried following code:
@ qDebug("Test try");
try {
throw std::exception();
}
catch (std::exception e) {
qDebug() << "Catch" << e.what();
}
qDebug("Test try: ok");@And got output:
@Test try
Test try: ok@My application is compiled with
@CONFIG += rtti
CONFIG += exceptions
QMAKE_CXXFLAGS_EXCEPTIONS_ON += -fexceptions@
and ndk-r9, qt5.4 on windows 8.1So, i summarize that exceptions are still do not working and how to enable them?
-
wrote on 23 Feb 2015, 13:48 last edited by
Sorry, it was output from some different display.
Actually there is:
@ qDebug("Test try");
try {
throw std::exception();
qDebug("\tpassed");
}
catch (std::exception e) {
qDebug() << "Catch" << e.what();
}qDebug("Test 2 try"); try { throw std::exception(); } catch (std::exception e) { qDebug() << "Catch" << e.what(); } qDebug("Test 2 try: ok"); qDebug("Test int try"); try { throw 1; qDebug("\tpassed"); } catch (int e) { qDebug() << "Catch" << e; } qDebug("Test int try: ok"); qDebug("Test char try"); try { throw "error"; qDebug("\tpassed"); } catch (const char * e) { qDebug() << "Catch" << e; } qDebug("Test char try: ok"); qDebug("Test all try"); try { throw; qDebug("\tpassed"); } catch (...) { qDebug() << "Catch all"; } qDebug("Test all try: ok"); qDebug("Test zero try"); try { int i(1/0); qDebug() << "\tpassed" << i; } catch (...) { qDebug() << "Catch zero"; } qDebug("Test zero try: ok");@
And output:
@D/BtMini ( 9108): Test try
D/BtMini ( 9108): Catch std::exception
D/BtMini ( 9108): Test 2 try
D/BtMini ( 9108): Catch std::exception
D/BtMini ( 9108): Test 2 try: ok
D/BtMini ( 9108): Test int try
D/BtMini ( 9108): Catch 1
D/BtMini ( 9108): Test int try: ok
D/BtMini ( 9108): Test char try
D/BtMini ( 9108): Catch error
D/BtMini ( 9108): Test char try: ok
D/BtMini ( 9108): Test all try
F/libc ( 9108): Fatal signal 11 (SIGSEGV) at 0xdeadbaad (code=1), thread 9124 (t.bibletimemini)@It is strange...
1/2