C++ support in nrf9160 modem_key_mgmt library

Env:

  • gcc version 10.3.1 20210824 (release) (GNU Arm Embedded Toolchain 10.3-2021.10)
  • std=c++11
  • nRF Connect SDK v2.0.0

C++ project won't build with modem_key_mgmt library:

undefined reference to `modem_key_mgmt_write(unsigned int, modem_key_mgmt_cred_type, void const*, unsigned int)'
collect2.exe: error: ld returned 1 exit status

modem_key_mgmt.h is missing 

#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif

Parents Reply
  • It's just a matter of adding mentioned code block

    #ifdef __cplusplus
    extern "C" {
    #endif
    ...
    #ifdef __cplusplus
    }
    #endif

    12 out of 14 header files in nrf/include/modem have it

    ./at_cmd_parser.h
    ./at_monitor.h
    ./at_params.h
    ./location.h
    ./lte_lc.h
    ./lte_lc_trace.h
    ./modem_attest_token.h
    ./modem_info.h
    ./modem_jwt.h
    ./nrf_modem_lib.h
    ./pdn.h
    ./sms.h

    except

    ./modem_key_mgmt.h
    ./nrf_modem_lib_trace.h

Children
Related