cancel
Showing results for 
Search instead for 
Did you mean: 

Why does STM32CubeIDE force C instead of C++?

Hello everyone,

I have a serious question. I'm currently working on a project using the STM32H755ZI board. Even though I set the project language to C++ and rename main.c to main.cpp, whenever I make any changes in the .ioc file, STM32CubeIDE automatically regenerates a new main.c file.

In other words, CubeIDE forces me to work in C.

To get around this, I followed a pretty comprehensive tutorial on how to use C++ indirectly with STM32 and the HAL, which you can find here:
:link: https://barenakedembedded.com/how-to-use-cpp-with-stm32-hal/
It's very helpful, but also a bit tedious.

Now here's my doubt:
I'm an undergraduate student, and I would really like to understand why STM boards (and even boards from other manufacturers) seem to push so hard for C instead of C++.
Is there a technical or historical reason why C is still the standard in embedded systems, even for modern projects?

Thanks in advance for any insights!

1 REPLY 1
Pavel A.
Evangelist III

Is there a technical or historical reason 

Let's say, for historical reason. Will you accept this as answer?

CubeIDE does not force you to work in C. It just assumes that any decent C++ developer knows enough C to use the ST libraries. Which are only available in C, for historic reasons. And technical too. Basically all it takes is to know what means extern "C".  Your own code can be all C++.