2024-08-17 02:10 PM
We created an empty C++ project. Then, added some web-sourced .cpp and .hpp code into the directory. Compiled and debugged with ST-Link MiniE fine. Entry is main.cpp
In STM32CubeIDE, click .ioc and edit init code with STM32MX. STM32MX generates main.c instead of main.cpp where our code resides.
Many thanks
Solved! Go to Solution.
2024-08-17 05:04 PM
This is the intended behavior. There is no problem with C and C++ files in the same project, and HAL is designed in C.
If you want to run a C++ function from within main.c, define it with extern "C" and call it normally. Calling a C++ main loop function right before the main loop in main.c is common.
2024-08-17 05:04 PM
This is the intended behavior. There is no problem with C and C++ files in the same project, and HAL is designed in C.
If you want to run a C++ function from within main.c, define it with extern "C" and call it normally. Calling a C++ main loop function right before the main loop in main.c is common.