cancel
Showing results for 
Search instead for 
Did you mean: 

how to use try catch in CubeIDE 1.3

Hoang_Tran
Associate III

I am trying to use try catch with cubeIDE. But get the error when compiling.0693W000001rFTIQA2.png

4 REPLIES 4
Nikita91
Lead II

The error message says "use -fexceptions". Did you do it?

thank you for reply!,how to use "use -fexception"?

TDK
Guru

Right click the project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MCU G++ Compiler -> Miscellaneous

Add the "-fexceptions" flag there.

Not sure how well it'll work, but it will compile.

If you feel a post has answered your question, please click "Accept as Solution".
Aurel
Associate II

Hi everyone,

As this link is the first one when looking for "stm32 try catch", I'm adding some extra info.

The previous answer doesn't work for me.

When looking on other thread, it turns out that the problem is linked with the "-specs=nano.specs".

A solution that works for me was to choose "Standard C, Standard C++" for the runtime library:


_legacyfs_online_stmicro_images_0693W00000bi6RxQAI.png 

 And:


_legacyfs_online_stmicro_images_0693W00000bi6TKQAY.png 

And


_legacyfs_online_stmicro_images_0693W00000bi6UDQAY.png