cancel
Showing results for 
Search instead for 
Did you mean: 

Create a new stm32 project correctly on 2.0.0 and use C++ for it

vernture
Associate III

Upgraded STM32CubeIDE to 2.0.0 and struggling with issues!
Installed CubeMX as a standalone program too. 

Now I'm confused how to create a STM32 project and as usual select C++ as the target language. 

1- Should I start from the IDE? There'll be no .ioc file then!
2- Should I start from CudeMX? There'll be no option to select C++ as the target language! 

How to fix it?
My purpose is to keep main.c, create .hpp, .cpp files and include the header in main.c to be able to call the functions defined in the .cpp file.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Super User

Create the project in STM32CubeMX.

After you open it in STM32CubeIDE, right click the project and select "Convert to C++". This will add the C++ compiler and look for *.cpp files.

Then add whatever *.cpp files you want and it'll work. You'll need to extern "C" the ones you call in main.c so the names don't get mangled.

If you feel a post has answered your question, please click "Accept as Solution".

View solution in original post

1 REPLY 1
TDK
Super User

Create the project in STM32CubeMX.

After you open it in STM32CubeIDE, right click the project and select "Convert to C++". This will add the C++ compiler and look for *.cpp files.

Then add whatever *.cpp files you want and it'll work. You'll need to extern "C" the ones you call in main.c so the names don't get mangled.

If you feel a post has answered your question, please click "Accept as Solution".