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

nrf_block_dev_sdc.h c++ compability

Hi,

A project I'm working on can be seen as a collector of data from many different sources. To keep I an overview I've decided to use C++ objects rather than C (in other words: a C++ project).

I'm now implementing the data storage part of the project, which will be on a SD card. However, I can't get the SD card part to work (with my limited C++ programming knowledge).

The following bit gives an error:

NRF_BLOCK_DEV_SDC_DEFINE(
    m_block_dev_sdc,
    NRF_BLOCK_DEV_SDC_CONFIG(
            SDC_SECTOR_SIZE,
            APP_SDCARD_CONFIG(SD_PIN_MOSI, SD_PIN_MISO, SD_PIN_SCK, SD_PIN_CS)
     ),
     NFR_BLOCK_DEV_INFO_CONFIG("Nordic", "SDC", "1.00")
);

Error: ...nrf_block_dev_sdc.h:93:5: error: cannot convert 'const nrf_block_dev_ops_t {aka const nrf_block_dev_ops_s}' to 'const nrf_block_dev_s::nrf_block_dev_ops_s*' in initialization**.

This code can also be seen in the fatfs example, and by changing the extension of main.c to main.cpp and executing "make" you can reproduce the error.

How can this be solved?

Related