Results 1 to 2 of 2

Thread: General C++ exception not working with QT Necessitas

  1. #1
    Join Date
    Aug 2012
    Posts
    3
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default General C++ exception not working with QT Necessitas

    Could someone tell me how to handle exceptions with a QT necessitas mobile app. I have Math app that throws an exception if something is divided by zero. The code works perfectly on QT SDK for windows but when I run the program on necessitas the app always crashes. Why can't I throw an exception? Remember this code works fine on QT SDK, when I use Necessitas QT SDK the app crashes.

    try
    {
    //Throw exception if divide by zero
    if ((terms[0] == 0) || (terms[3]== 0) || (terms[6] == 0) || ((terms[9]-terms[11])== 0 ) || ((terms[12]+terms[14])== 0 ))
    throw "Cannot divide by 0 term";


    this->answerline1->setText(QString::number(((terms[1]+terms[2])/terms[0])));
    this->answerline2->setText(QString::number(((terms[4]-terms[5])/terms[3])));
    this->answerline3->setText(QString::number(((terms[7]*terms[8])/terms[6])));
    this->answerline4->setText(QString::number((terms[10])/(terms[9]-terms[11])));
    this->answerline5->setText(QString::number((terms[13])/(terms[12]+terms[14])));
    }
    catch(const char * message)
    {
    cerr << "Error " << message << endl;
    }

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: General C++ exception not working with QT Necessitas

    Necessitas uses the Android NDK. Android NDK versions pre-NDK R5 do not support exceptions, and exceptions are off by default even in the later versions.

    http://stackoverflow.com/questions/4...of-c-exception
    http://developer.android.com/tools/sdk/ndk/index.html#

Similar Threads

  1. General C++ exception not working with QT Necessitas
    By blackrue2000 in forum Qt Programming
    Replies: 4
    Last Post: 19th August 2012, 00:35
  2. Qt Necessitas for Android
    By jeyanthinatarajan in forum Newbie
    Replies: 5
    Last Post: 22nd June 2012, 09:03
  3. Necessitas Android Help
    By RENOLD in forum Qt Programming
    Replies: 0
    Last Post: 6th March 2012, 04:51
  4. Qt Necessitas - setFullScreen ?
    By leviribeiro in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 2nd November 2011, 22:56
  5. Qt for Android. Necessitas
    By freely in forum Newbie
    Replies: 3
    Last Post: 27th May 2011, 18:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.