Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Compiling crypto example with C++

Hi guys,

I know that there is no official support for C++ on NordicSemi side, but I just wonder if it would be possible to work with C++ in Segger IDE. I'm trying to integrate optiga IC in my project and started with this example in nRF5_SDK_v3.0. I renamed main.c to main.cpp and compiled it. When I compile I get a missing '}' error. 

expected ‘}’ at end of input

I am trying to track down the error. What I did:

- I commented out all function defs, and removed all code in main.cpp. Still the same error

- I put a closing '}' after "nrf_crypto.h" in main.cpp, and the error clears. 

#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "sdk_common.h"
#include "nrf_assert.h"
#include "app_error.h"
#include "nrf_log.h"
#include "nrf_log_ctrl.h"
#include "nrf_log_default_backends.h"
#include "nrf_crypto.h"
} // THIS FIXES
#include "nrf_crypto_ecc.h"
#include "nrf_crypto_error.h"
#include "nrf_crypto_ecdsa.h"

- I tried to go deep and got stuck at "nrf_crypto_eddsa_backend.h" because of dependencies for other libraries. I believe there is a problem with 

#ifdef __cplusplus
extern "C" {
#endif

definitions without closing brace, but I couldn't point it.

I appreciate if you can help me with that. Is there any static analyzer or any other tool that I can use for the purpose?

Best regards,

Vedat

Parents
  • SES supports C++ : Yes and No.  It has limited C++ support.  Their GCC distribution has a few C++ includes files removed.  You can compile naked C++ but not using advance C++11 and above features.  

    Compile error : not sure why but I do compile crypto in C++ no problem.  I am not using SES though.  I use full GCC distribution with Eclipse.

Reply
  • SES supports C++ : Yes and No.  It has limited C++ support.  Their GCC distribution has a few C++ includes files removed.  You can compile naked C++ but not using advance C++11 and above features.  

    Compile error : not sure why but I do compile crypto in C++ no problem.  I am not using SES though.  I use full GCC distribution with Eclipse.

Children
No Data
Related