A step-by-step guide to setting up a C++ project on STM32 microcontrollers using STM32CubeIDE. Since ST Microelectronics provides only C libraries, the approach involves creating a standard STM32 project, renaming main.c to main.cpp, and verifying that the g++ compiler is invoked for C++ files while C files continue to use gcc. A simple counter struct is used to demonstrate that C++ classes and constructors work correctly alongside the existing C HAL libraries, with debugging in STM32CubeIDE confirming correct execution on hardware.

7m read timeFrom beningo.com
Post cover image
Table of contents
C++ Project CreationWhy does it look like a C project?Compile the Embedded C++ ProjectAdding a Test ClassWriting some Test CodeRunning the Embedded C++ ProjectConclusions
11 Impressions