Showing results for 
Search instead for 
Did you mean: 

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

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 but seems that the option mentioned new->convert is not present anymore?

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)

Associate II

Yes, I found that the option is on the right click menu -> convert to c++, as suggested in here

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


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

Pavel A.
Evangelist III