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

Programming nRF52 DK in C++ in Segger Embedded Studio

Hi.

I am writing software for my custom nRF52832 device but hardware wise it is identical to the nRF52 DK. 

I'm not that good of an embedded coder (or any kind of coder for that matter) and I am trying to integrate some i2c sensors on my device. 

But all the libraries of these sensors are written in C++, and are using objects and classes. Which C doesn't support.

I have managed to convert *some* of the code (in probably a very inefficient way) to plain C, but most of the code is beyond my capabilities. 

How can I code with C++ on this thing using Segger Embedded Studio? 

Any help would be greatly appreciated. 

- Usman

Parents Reply
  • Hi Torbjørn.

    Thank you so much for the help. 

    I took your code and made mine similar to it. It turns out I was misunderstanding the instructions all along, and now the code compiles. Just one little problem left.

    Whenever I include the app_idle_state_handle() in the code, it fails to compile, says "undefined reference to `app_idle_state_handle'", even though I know the functioned is fully defined in both .c and .h files. I don't know why it does this. But when I remove the function call from main.cpp, all works well. 

    If I call the same function in the .c file, it works perfectly. If you can provide any guidance with that, that would be great, but it's not a major issue, since it wasn't useful to me anyway. 

    Best regards,

    Usman

Children
Related