cancel
Showing results for 
Search instead for 
Did you mean: 

How to Create STM32 C++ project in STM32 VS Code?

kaosad
Visitor

I am able to create C++ project in STM32CubeIDE, like so:

kaosad_0-1759734935131.png

However, I can't find a way to do the same in STM32 VS Code. Is there such a feature in VS Code for STM32?

2 REPLIES 2
Cartu38 OpenDev
Lead III

@kaosad,

Considering STM32CubeIDE for Visual Studio Code solution, no C/C++ concerns to get.
This solution relies on CMake as build system. Related toolchain file is both C and C++ capable. CMake is then managing the stuff properly for you taking care based on file extensions (.c or .cpp).

Let's start from empty project without any worries here:

Cartu38OpenDev_0-1759737912623.png

By default main.c template is promoted. Just rename it to main.cpp and update CMakeLists.txt reference in sync. It will work !

Cartu38OpenDev_1-1759738155643.png

Cartu38OpenDev_2-1759738194727.png

Imen.D
ST Employee

Hello @kaosad and welcome to the Community

You can refer to these articles contain steps and tips on using VS Code with CMake for STM32 projects:

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen