How to properly convert c ++ project?
Hi Kevin:
“Error_Handler” function is already in main.cpp.
The following are my steps:
1. STM32CubeMx -> Generate
2. SW4STM32 -> Import -> General -> Exisiting projects into Workspace
3. SW4STM32 -> Windows -> Preferences -> Indexer -> uncheck “Index unused header”
(It will show few errors when I import the new project, so I uncheck this option.)
4. SW4STM32 -> project folder -> right-click -> Convert to C++
Until above, there is no errors and compile success.
-------------------------------------------------------------------------------
5. SW4STM32 -> project folder/Src/main.c -> right-click -> rename “main.c” to “main.cpp”
There show a lot of errors.
Error: http://i.imgur.com/LeOCxY0.jpg
Console: http://codepad.org/nJUeXLDw
-------------------------------------------------------------------------------
6. SW4STM32 -> project folder -> right-click -> properties -> C/C++ Build -> Settings
a. MCU G++ Compiler -> Preprocessor -> Defined symbols(-D) -> add
Symbols: http://i.imgur.com/9PkTduH.jpg
b. MCU G++ Compiler -> Includes Include paths (-I) -> add
../Inc
../Drivers/STM32F4xx_HAL_Driver/Inc
../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy
../Drivers/CMSIS/Include
../Drivers/CMSIS/Device/ST/STM32F4xx/Include
c. MCU G++ Compiler -> General -> Linker Script(-T) -> add
C:\Users\Top\Desktop\STM32\stm32test\myUART\STM32F411RETx_FLASH.ld
d. MCU G++ Compiler -> Miscellaneous -> Linker flags -> add
-specs=nosys.specs -specs=nano.specs
7. SW4STM32 -> Search -> Search -> File Search -> Containing text: -> “main.c”
Search result: http://i.imgur.com/034E7cK.jpg
8. Modify “main.c” to “main.cpp”
Modify result: http://i.imgur.com/70ywlbA.jpg
Error: http://i.imgur.com/2q2NMYg.jpg
Console: http://codepad.org/UvYc9DrD
I think maybe I loss some steps, how should I do next?