1

I'm using a port of the STL found here and trying to debug with a simple try{...}catch{...} loop. When compiling with the Arduino IDE, I get the error message

exception handling disabled, use -fexceptions to enable.

I'm not quite sure what this means. Can the Arduino simply not support exceptions? Or is -fexceptions a compiler flag I can enable?

  • It's just disabled and if you want to use it, you have to provide -fexceptions flag to the compiler. – KIIV May 14 at 12:07
  • Great, thanks for the help! – Snail Cadet May 14 at 12:19
1

As you have already found out, add -fexceptions to the compiler flags. This can be done by modifying the platform.txt of your Arduino IDE installation.

See https://github.com/arduino/ArduinoCore-avr/blob/master/platform.txt#L28. There is -fno-exceptions defined, so you have to remove that, too.

  • Perfect, this is the (complete) answer I was looking for. – Snail Cadet May 14 at 13:02
0

Arduino is a very limited platform, and handling exceptions requires quite a bit of hidden code to properly unwind the stack wherever the exception occurs.

So the default is to turn it off and teach users to not use exceptions in arduino and instead other type of error handling.

  • The default is not to use STL neither. – DataFiddler May 14 at 13:38
  • It's not just the default; Arduino has no built-in support for the STL. – Snail Cadet May 14 at 13:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.