cancel
Showing results for 
Search instead for 
Did you mean: 

Can stm32f103 use C++?

Glee.11
Associate II

Hi All,

Can stm32f103 use C++? for programing not c.

I'm using stm32f103 / truestudio / cubemx.

I want to use some c++ ​grammer for programing.

If there's way to use c++

How i can use c++ in stm32f103?

regard.

1 ACCEPTED SOLUTION

Accepted Solutions
TDK
Guru

Of course. The chip doesn't know what language you're using, it only sees the compiled code.

Most compilers are smart enough to realize *.cpp files are C++ while *.c files are C.

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

View solution in original post

4 REPLIES 4
TDK
Guru

Of course. The chip doesn't know what language you're using, it only sees the compiled code.

Most compilers are smart enough to realize *.cpp files are C++ while *.c files are C.

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

Thank you for your reply.

Is there any configuration for using c++?

or just use c++?

In Keil it is pretty straight forward, in GNU/GCC you need to make sure the linker script and startup code manage constructors properly.

The HAL code isnt in C++ so you'll need to interface with that.

The CPU ​doesn't care how you generate code, but in embedded you need to be significantly more aware of how the MCU and tools function and interact.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

IAR will compile C++ for that chip. They include good start up and linker files so it's simple to get running. The STM Cube examples usually have project files for IAR.