How to enable exceptions?

Andreas Pakulat apaku at gmx.de
Sat Mar 27 08:16:40 GMT 2010


On 27.03.10 14:16:05, Lindsay Mathieson wrote:
> As per the subject - when trying to use exceptions with C++ code I get the 
> "exception handling disabled, use -fexceptions to enable" error.
> 
> I've gone into Configuration, Advanced values and added "-fexceptions" to 
> CMAKE_CXX_FLAGS, reconfigured, cleaned and rebuilt, but I still get the error.

Not really something to do with kdevelop, but KDE's cmake code sets up
a variable to use with add_definitions() to enable exceptions for a
given directory: KDE4_ENABLE_EXCEPTIONS. So you can just do this:

add_definitions(${KDE4_ENABLE_EXCEPTIONS})

to enable exception support. I'm not sure why adding to cmake-cxx-flags
doesn't work, but I do recall that FindKDE4Internal.cmake does some
nasty things wrt. compiler flags that don't end up in the cache and are
hence being re-run on each cmake run.

Andreas

-- 
You look like a million dollars.  All green and wrinkled.




More information about the KDevelop mailing list