This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

C++ in NRF9160

Hey,

I was wondering if I can write C++ code for the NRF9160:

  • Does the NRF9160 DK support C++?
  • Is SEGGER IDE compatible with it?
  • Is it recommended to use C++ in it?

Thanks in advance!

Tal

Parents
  • Hi.

    As says, you can use any language as long as the compiler supports the Cortex M33.

    When it comes to using C++ with the nRF Connect SDK, that is not recommended.

    The Zephyr Project does support C++ using CONFIG_CPLUSPLUS and CONFIG_LIB_CPLUSPLUS, although it is still experimental. The up-stream tracking issue is here: https://github.com/zephyrproject-rtos/zephyr/issues/18554

    When it comes to NRF, NRFXLIB, and MCUBOOT, I am not sure how well they support C++.

    The main.c file must have a .cpp suffix for the build system to recognize that it should use a CXX compiler. See zephyr\samples\cpp_synchronization\src\main.cpp for a working C++ sample.

    However, I would recommend using C unless you have a very good reason for using C++. That way, it will be more tested, and we will be more able to help you if you encounter any problems.

    Best regards,

    Didrik

Reply
  • Hi.

    As says, you can use any language as long as the compiler supports the Cortex M33.

    When it comes to using C++ with the nRF Connect SDK, that is not recommended.

    The Zephyr Project does support C++ using CONFIG_CPLUSPLUS and CONFIG_LIB_CPLUSPLUS, although it is still experimental. The up-stream tracking issue is here: https://github.com/zephyrproject-rtos/zephyr/issues/18554

    When it comes to NRF, NRFXLIB, and MCUBOOT, I am not sure how well they support C++.

    The main.c file must have a .cpp suffix for the build system to recognize that it should use a CXX compiler. See zephyr\samples\cpp_synchronization\src\main.cpp for a working C++ sample.

    However, I would recommend using C unless you have a very good reason for using C++. That way, it will be more tested, and we will be more able to help you if you encounter any problems.

    Best regards,

    Didrik

Children
No Data
Related