In the project .pro file I’ve specified:
QMAKE_CXXFLAGS += -fno-exceptions
Yet I’m able to throw exceptions in my app. Any thoughts on that?
Example: This shouldn’t work, but it works
#include <QApplication>
#include <QtDebug>
int main(int c, char**v)
{
QApplication app(c,v);
try
{
throw 1;
}
catch(int i)
{
}
return app.exec();
}
You do not turn off exceptions by setting
QMAKE_CXXFLAGSbecause this options is handled byCONFIG. You should useto turn them off.
See the g++ args when you have neither
QMAKE_CXXFLAGSnorCONFIGsettings changed:Now, let’s set
QMAKE_CXXFLAGS: getOoops, we get our
-fno-exceptionsis overridden byCONFIG‘s-fexceptions.Now, let’s set
CONFIG:Oh! compilation error!