3

I'm using a port of the STL foundhere and trying to debug with a simpletry{...}catch{...} statement. When compiling with the Arduino IDE, I get the following error message:

exception handling disabled, use -fexceptions to enable.

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

askedMay 14, 2019 at 11:58
Snail Cadet's user avatar
1
  • It's just disabled and if you want to use it, you have to provide-fexceptions flag to the compiler.CommentedMay 14, 2019 at 12:07

2 Answers2

6

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

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

answeredMay 14, 2019 at 13:01
Maximilian Gerhardt's user avatar
1
  • Perfect, this is the (complete) answer I was looking for.CommentedMay 14, 2019 at 13:02
1

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.

answeredMay 14, 2019 at 12:11
ratchet freak's user avatar
2
  • 1
    The default is not to use STL neither.CommentedMay 14, 2019 at 13:38
  • It's not just the default; Arduino has no built-in support for the STL.CommentedMay 14, 2019 at 13:52

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.