keil 5 报错后的反思-头文件中声明函数

目录

漏一个分号,导致4个错误!

反思:


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 "{"

反思:

一、有时候,注释最好另起一行开始写。这样可能便于发现问题!

二、当然,还需从根本上理解在头文件里声明函数的操作,从源头控制错误。

 

 

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值