Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. [SOLVED] Exception handling on Android
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Exception handling on Android

Scheduled Pinned Locked Moved Mobile and Embedded
2 Posts 1 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kostyamaslyuk
    wrote on 23 Feb 2015, 12:38 last edited by
    #1

    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.1

    So, i summarize that exceptions are still do not working and how to enable them?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kostyamaslyuk
      wrote on 23 Feb 2015, 13:48 last edited by
      #2

      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 Reply Last reply
      0

      1/2

      23 Feb 2015, 12:38

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved