自己总结一些自己曾经遇到过的STM32错误总结及解决方法。
1...\..\User\adc\bsp_adc.c(27): error: #268: declaration may not appear after executable statement in block
原因:在ANSI的C标准中,C89标准----变量的一定是在< { >、
的后面,而不能在语句的后面,而C99标准中,变量可以任意地方定义,不强制。
解决方法:点开魔法棒,在C/C++里勾选C99模式即可。
2..\..\Output\USART.axf: Error: L6200E: Symbol ADC_ConvertedValue multiply defined (by bsp_adc.o and main.o).
原因:双重定义了。
解决方法:加关键字extern
引用,表示我们的变量来自于其他文件。
3.Error: L6200E: Symbol SysTick_Handler multiply defined (by stm32f10x_it.o and m
原因:因为STM32库函数内置了一个写SysTick
的中断函数库 stm32f10x_it.h
之中
解决方法:stm32f10x_it.c
之中的<void SysTick_Handler(void){ }>
注释即可。
4.Error:Flash Download failed - "Cortex-M3"
原因:CMSIS-DAP下载烧录程序失败
解决方法:正确配置的前提下,在Connect
选择under Reset
。
5.error:#20: identifier "TIM_TimeBaseInitTypeDef" is undefined
原因:没有包含相应的头文件
解决方法:最简单粗暴的方法是在main.c
里找到stm32f103x_conf.h
,取消注销全部头文件即可。
注:本文版权归作者所有,禁止转载