2025-10-06 12:17 AM
I am able to create C++ project in STM32CubeIDE, like so:
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?
2025-10-06 1:10 AM
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:
By default main.c template is promoted. Just rename it to main.cpp and update CMakeLists.txt reference in sync. It will work !
2025-10-06 1:47 AM - edited 2025-10-06 3:00 AM
Hello @kaosad and welcome to the Community
You can refer to this article contains steps on how to add post build commands in VS Code:
2025-10-06 4:35 AM
Thanks. But that would create an empty project. I am looking for a way to create a C++ STM32CubeMX project just like what STM32CubeIDE is able to do.
2025-10-06 4:41 AM
Thanks for the useful article. Does STM32 VSCode provide a feature that can create C++ STM32CubeMX project without needing to meddle with the CMake script, just like STM32CubeIDE, which does not need any meddling with the Make script?
2025-10-06 4:44 AM
Your question is bit unclear to me to be fair.
STM32CubeIDE is supporting collection of project creation modes (empty, from examples, MX, from binary, ...).
Your first post is promoting STM32CubeIDE empty project GUI. I've answered about very same feature.
If you're looking for a STM32CubeMX, please do it but no C++ option has never been supported here.
Such said let's proceed very same:
Just be aware at next code updqte triggered from STM32CubeMX ... main.c may come back. STM32CubeMX has never generated a main.cpp.
2025-10-06 4:57 AM
Nope, at that time you have to dig into the CMake project by your own.
I'm not aware of STMicroelectronics' plans here, but possibly they are eager to listen to our requests/suggestions here. What would help you the most here? Feel free to share your pain and wishes! If you're not trying, nothing may happen.