This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Using C++ std::exceptions with NCS

Hi,

we're using a library which is written in C++ and is using exceptions. As stated here Zephyr has C++ support including exceptions.

Following the docs I set

Fullscreen
1
2
3
4
5
6
7
8
...
CONFIG_CPLUSPLUS=y
CONFIG_LIB_CPLUSPLUS=y
CONFIG_NEWLIB_LIBC=y
CONFIG_EXCEPTIONS=y
CONFIG_NEWLIB_LIBC_NANO=n
...
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

But this leads to a linker error:

fini.c:(.text.__libc_fini_array+0x20): undefined reference to `_fini' 

When removing 

CONFIG_NEWLIB_LIBC_NANO=n

the code is being compiled with a warning that CONFIG_EXCEPTIONS is set to 'n' because of unsatisfied dependencies (!NEWLIB_LIBC_NANO). In this case thrown exceptions are not catched. Instead of running the catch-path the code is running into _exit in libc-hooks.c which is part of newlib. 

So, does anybody know how to enable the exception support? Am I missing some more CONFIGs?

Regards,
Oliver