2025-06-11 9:33 AM - edited 2025-06-11 9:40 AM
I am having a hard time to set up a STM32 project in VS Code that works with all C++ features.
I set up my CMakeLists and enabled CXX language and add all my sources and so on.
When I keep my main.c and get my c++ functions with extern form a cpp file, the compiler does not find c++ functions like <cmath> that I include in my hpp headers.
I also tried setting up a project that I could open in VS Code and CubeIDE. In Cube IDE I renamed the main.c to main.cpp . And there in Cube IDE everything compiles fine.
In VS Code I get errors for the same project like and <cmath> is only found when I manually include the arm-none-eabi folder:
undefined reference to `MX_SPI1_Init'",
What is the best way transform a CMake project from CubeMX to C++?