使用STM32CubeMX重新生成程式碼報錯SystemCoreClock multiply defined
阿新 • • 發佈:2019-01-11
編譯工程,會出現如下錯誤:
Error: L6200E: Symbol SystemCoreClock multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o).
Error: L6200E: Symbol AHBPrescTable multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o).
Error: L6200E: Symbol APBPrescTable multiply defined (by system_stm32f4xx_1.o and system_stm32f4xx.o).
rror: L6200E: Symbol SVC_Handler multiply defined (by stm32f4xx_it.o and irq_cm4f.o).
(單擊圖片可放大)
同樣的,這是由於STM32CubeMX生成的工程所包含的檔案"system_stm32f4xx.c"(Drivers/CMSIS工程資料夾下,見下圖)中,已經存在上面編譯錯誤中的段。這和工程中的檔案"system_stm32f4xx.c"(Deviece工程資料夾下,見下圖)中的程式碼相沖突:
將Drivers/CMSIS工程資料夾中的"system_stm32f4xx.c"排除在編譯之外。右鍵第一個system_stm32f4xx.c,移除即可
參考資料: