Vector linking errors with c++ library

How do we avoid this error when integrating a c++ library into the build?

```c:\ncs\toolchains\v2.2.0-rc1\opt\zephyr-sdk\arm-zephyr-eabi\arm-zephyr-eabi\include\c++\12.1.0\bits/vector.tcc:71: undefined reference to `std::__throw_length_error(char const*)'
c:\ncs\toolchains\v2.2.0-rc1\opt\zephyr-sdk\arm-zephyr-eabi\arm-zephyr-eabi\include\c++\12.1.0\bits/stl_vector.h:1905: undefined reference to `std::__throw_length_error(char const*)'
c:\ncs\toolchains\v2.2.0-rc1\opt\zephyr-sdk\arm-zephyr-eabi\arm-zephyr-eabi\include\c++\12.1.0\bits/stl_vector.h:1894: undefined reference to `std::__throw_length_error(char const*)'
c:\ncs\toolchains\v2.2.0-rc1\opt\zephyr-sdk\arm-zephyr-eabi\arm-zephyr-eabi\include\c++\12.1.0\bits/stl_vector.h:1894: undefined reference to `std::__throw_length_error(char const*)'
c:\ncs\toolchains\v2.2.0-rc1\opt\zephyr-sdk\arm-zephyr-eabi\arm-zephyr-eabi\include\c++\12.1.0\bits/stl_vector.h:1905: undefined reference to `std::__throw_length_error(char const*)'
c:\ncs\toolchains\v2.2.0-rc1\opt\zephyr-sdk\arm-zephyr-eabi\arm-zephyr-eabi\include\c++\12.1.0\bits/stl_vector.h:1905: undefined reference to `std::__throw_length_error(char const*)'```

Parents Reply
  • Hello, thank you- I have set `CONFIG_CPLUSPLUS=y` in the prj.conf.

    I am also using the 2.2.0 toolchain, the directory path is just incorrect- you can see that it is in fact picking up the correct toolchain: `Using NCS Toolchain 2.2.0 for building. (C:/ncs/toolchains/v2.2.0-rc1/cmake)`

    I wonder if there is another way I could incorporate my c++ library? So that it can be compiled with all the same compiler flags as the rest of the application? Or could the entire build be compiled with c++?

    Have tried multiple options and stuck at the moment

Children
Related