cancel
Showing results for 
Search instead for 
Did you mean: 

Setup STM32 Project wizard incorrectly generates C++ target

etheory
Senior II

When I select the following options from the Project Explorer using "New->STM32 Project":0690X00000DC8sqQAD.jpg

One would expect that the project would be set up as a C++ project, especially considering that the option is presented to the user.

However this is not the case.

Choosing C or C++ produces exactly the same main.c and other files.

This option seems to serve no purpose.

Is there anything else I need to do to have the entire project work as a C++ project, or do I have to continue using the usual 'extern "C"' work-arounds that I'm currently using?

1 REPLY 1
KnarfB
Principal III

A C++ project has C++ compiler build settings but does not generate C++ files. You can add your own C++ files and call your C++ functions from a user code section in main() in main.c using C++ extern C. This separates all generated code from your C++ code and works well for me, e.g. for using ROS (rosserial) code.