C++ programing when generating from CubeMX
Hello!
I’m trying to write a program in C++ using Cube MX.
1. When generating, then importing, adding my own code in C, it works fine.
2. When choosing “Convert to C++”, there are some errors.
First error:
I use a timer in my code. At the end of the timer initialization, there is a function
HAL_TIM_MspPostInit(&htim1);. When in C, there is no problem. When converting
to C++, it gets a compilation error: undefined reference to HAL_TIM_MspPostInit(TIM_HandleTypeDef*)
CubeMX generates the call, but not the function itself, and the function is external.
Second error:
In stm32f7xx_hal_msp.c, it says undefined reference to Error_Handler.
In the same file, Error_Handler is declared as external, and the definition is in main.c (renamed .cpp).
Can anyone help me to fix these errors?
Thanks,
Dora.