We have a QT based C++ application. In which we are using third party DLL files too. But, C++ try and catch does not work at all.
For example:
#include <QCoreApplication>
#include <QDebug>
#include <QException>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
int arr[10];
try
{
arr[11] = 30;
}
catch (const std::out_of_range& e)
{
qDebug() << "Exception out of range occurred ..." << e.what();
}
catch (...)
{
qDebug() << "Unknown Exception occurred...";
}
return a.exec();
}
Above is the minimal example. In the above, it crashes the program. Is there a way to handle this?