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

Use C++ with Nordic SDK (nRF52 series)

Hi, i wrote a lot of firmwares for nRF51x22 using C language and they works fine. Now we passed to nRF52 series and we want to use C++ (preferibly C++11) that is more readable, ordered etc... but i got a lot of difficulties to setup a project.

I'm basing on ble_app_template and i used

extern "C" { }

for all inclusions but i got a lot of errors in some drivers and libraries of SDK.

Can you give me a detailed step-by-step tutorial to setup a project to compile with C++?

I'm using Keil 5.23 with ARMCC 5.06

Thank you.

Parents Reply
  • Can you please take my example and try to complile it. Put it in your examples/ble_peripheral folder. It should work after you change nrf_section.h:143 line. So when that works. Try to add #include <string> after extern "C" {} and in main function add std::string mystr("hello world!"); and try to fix the compile error. I was trying yesterday for few hours but without success.

Children
No Data
Related