cancel
Showing results for 
Search instead for 
Did you mean: 

C++ with STM32CubeMX and CubeIDE

shabaz
Associate

Hi,

I'd like to use C++, and I had a question.

Currently my procedure is:

(a) Configure the peripherals using CubeMX (since I wish to use MX HAL) and generate code .

(b) In CubeIDE I rename the main.c file to main.cpp, and then from the project window I right-click the project name and select Convert to C++

Although that procedure initially works, the problem is that if I subsequently wish to make additional peripheral configuration changes, things get messy, because if I use CubeMX and click on Generate Code, it won't modify the existing main.cpp and will instead create a new main.c file, because it thinks I'm coding in C. Now I have a merge problem to get the auto-generated content in main.c into main.cpp and then have to re-click on Convert to C++. What's the correct procedure I should be using?

1 ACCEPTED SOLUTION
2 REPLIES 2