cancel
Showing results for 
Search instead for 
Did you mean: 

How to convert a C project into C++ project?

AndrewBloom
Associate II

Seems I cannot add cpp files to a sample project (NUCLEO-H723ZG HID_Standalone (USB_Host)) because the project is of C nature. How to convert it to C++, so the makefile and mk files are generated taking into account cpp files? I found https://community.st.com/t5/stm32cubeide-mcu/no-debug-information-available-after-quot-convert-to-c-c-adds/m-p/321877#M17426 but seems that the option mentioned new->convert is not present anymore?

4 REPLIES 4
Pavel A.
Evangelist III

Just look in the Fine Manual. It's there.

(but files generated by Cube remain .c. this is a feature, not a bug)

AndrewBloom
Associate II

Yes, I found that the option is on the right click menu -> convert to c++, as suggested in here https://community.st.com/t5/stm32cubeide-mcu/undefined-reference-to-main-error-while-convert-c-project-to-cpp/m-p/189548

Now I'm fighting with the hundred error messages, 
In file included from /Users/bloom/STM32CubeIDE/workspace_1.13.0/HID_Standalone/Core/Src/main.cpp:21:
../../Core/Inc/main.h:27:1: note: 'extern "C"' linkage started here 

It's a very productive environment! :D

In the file HID_Standalone/USB_Host/Target/usbh_conf.h for the aforementioned board/sample, there's this missing at the end of the file:

 

 

#ifdef __cplusplus
}
#endif

 

maybe you can add it to the Fine Manual. :D :p

Pavel A.
Evangelist III