Hi,
I'm compiling a piece of code that uses USB CDC ACM from a .cpp file, and I stumbled on the compiler complaining about out of order initializers in app_usbd_cdc_acm_internal.h.
Error is triggered by the macro APP_USBD_CDC_ACM_INST_CONFIG, which is called by APP_USBD_CDC_ACM_GLOBAL_DEF.
Error shown below.
I am using SEGGER Embedded Studio for ARM Release 4.42 Build 2020012702.41180 Linux x64, and SDK 16.0.0. The project is derived from the Blinky example.
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’
To workaround this I had to modify app_usbd_cdc_acm_internal.h so it reads as follows : (basically I looked up the definition of the struct, and reordered initializers accordingly)
#define APP_USBD_CDC_ACM_INST_CONFIG(user_event_handler, \ comm_ifc, \ comm_ein, \ data_ifc, \ data_ein, \ data_eout, \ cdc_protocol, \ ep_list) \ .inst = { \ .comm_interface = comm_ifc, \ .comm_epin = comm_ifc, \ .data_interface = data_ifc, \ .data_epout = data_eout, \ .data_epin = data_ein, \ .protocol = cdc_protocol, \ .user_ev_handler = user_event_handler, \ .p_ep_interval = ep_list \ }
This, and the fact that I also had to move the definition of enum app_usbd_cdc_acm_user_event_e to this file to get rid of an inoperative forward declaration, leaves me pondering :
Do you officially support C++ compilation with your SDK ?
David Taillé