I am migrating my project to C++. Everything in the SDK works so far except NRF_BLE_GATT_DEF(). This returns the error C++ requires a type specifier for all declarations. Is there a workaround?
I am migrating my project to C++. Everything in the SDK works so far except NRF_BLE_GATT_DEF(). This returns the error C++ requires a type specifier for all declarations. Is there a workaround?
Another error occurs in the APP_USBD_CDC_ACM_GLOBAL_DEF:
static void cdc_acm_user_ev_handler(app_usbd_class_inst_t const * p_inst, app_usbd_cdc_acm_user_event_t event); /** * @brief CDC_ACM class instance * */ APP_USBD_CDC_ACM_GLOBAL_DEF(m_app_cdc_acm, cdc_acm_user_ev_handler, CDC_ACM_COMM_INTERFACE, CDC_ACM_DATA_INTERFACE, CDC_ACM_COMM_EPIN, CDC_ACM_DATA_EPIN, CDC_ACM_DATA_EPOUT, APP_USBD_CDC_COMM_PROTOCOL_AT_V250);
Error invalid conversion from 'void (*)(const app_usbd_class_inst_t*, app_usbd_cdc_acm_user_event_t)' {aka 'void (*)(const app_usbd_class_inst_s*, app_usbd_cdc_acm_user_event_e)'} to 'app_usbd_cdc_acm_user_ev_handler_t' {aka 'void (*)(const app_usbd_class_inst_s*, int)'}
Changing the event type to int gives another error about initialization.
Actually, when I convert it to int:
static void cdc_acm_user_ev_handler(app_usbd_class_inst_t const * p_inst, int event);
Error designator order for field 'app_usbd_cdc_acm_inst_t::comm_interface' does not match declaration order in 'app_usbd_cdc_acm_inst_t'
Data structure assignments must be in the order as the defined in the structure in C++. You need to re-order the assignments. For example.
typedef struct {
int a;
float b;
char c;
} X_t;
// Wrong order, rejected by C++, accepted by C
X_t failedAssign = {
.b = 1.0,
.a = 3,
};
// Correct order, accepted by both
X_t goodAssign = {
.a = 3;
.b = 1.0,
};
Unfortunately there are a lot of those in the SDK.
Data structure assignments must be in the order as the defined in the structure in C++. You need to re-order the assignments. For example.
typedef struct {
int a;
float b;
char c;
} X_t;
// Wrong order, rejected by C++, accepted by C
X_t failedAssign = {
.b = 1.0,
.a = 3,
};
// Correct order, accepted by both
X_t goodAssign = {
.a = 3;
.b = 1.0,
};
Unfortunately there are a lot of those in the SDK.