Skip to main content
Glee.11
Associate III
August 26, 2020
Solved

Can stm32f103 use C++?

  • August 26, 2020
  • 4 replies
  • 2019 views

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.

This topic has been closed for replies.
Best answer by TDK

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.

4 replies

TDK
TDKBest answer
August 26, 2020

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""."
Glee.11
Glee.11Author
Associate III
August 26, 2020

Thank you for your reply.

Is there any configuration for using c++?

or just use c++?

Tesla DeLorean
Guru
August 26, 2020

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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
Oliver Sedlacek
Senior
August 26, 2020

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.