目录
Rebuild started: Project: Templates-REG
*** Using Compiler 'V5.06 update 6 (build 750)', folder: 'E:\Keil_v5\ARM\ARMCC\Bin'
Rebuild target 'Target 1'
assembling startup_stm32f10x_hd.s...
compiling stm32f10x_gpio.c...
stm32f10x_gpio.c(9): error: #130: expected a "{"
void GPIO_SetBits(GPIO_TypeDef *GPIOx,uint16_t GPIO_Pin)/*GPIO两个形参:GPIO_Typedef *GPIOx和uint16_t_Pin0;拼写错误void GPIO_SetBits(GPIO_TypeDef *GPIOx,uint16_t GPIO_Pin)*/
stm32f10x_gpio.c(11): error: #20: identifier "GPIO_Pin" is undefined
GPIOx->BSRR |= GPIO_Pin;
stm32f10x_gpio.c(20): error: #247: function "GPIO_Init" has already been defined
void GPIO_Init(GPIO_TypeDef* GPIOx, GPIO_InitTypeDef* GPIO_InitStruct)//GPIO_TypeDef* GPIOx,形参之一,结构体指针传进来是哪个外设
stm32f10x_gpio.c: 0 warnings, 3 errors
compiling main.c...
main.c(5): error: #130: expected a "{"
int main (void)
main.c: 0 warnings, 1 error
".\Templates-REG.axf" - 4 Error(s), 0 Warning(s).
Target not created.
Build Time Elapsed: 00:00:00
漏一个分号,导致4个错误!
stm32f10x_gpio.c(9): error: #130: expected a "{"
stm32f10x_gpio.c(11): error: #20: identifier "GPIO_Pin" is undefined
stm32f10x_gpio.c(20): error: #247: function "GPIO_Init" has already been defined
main.c(5): error: #130: expected a "{"
反思:
一、有时候,注释最好另起一行开始写。这样可能便于发现问题!
二、当然,还需从根本上理解在头文件里声明函数的操作,从源头控制错误。