【Keil5报错1】不正确定义数据与不正确添加头文件导致的问题 Symbol MX_GPIO_Init multiply defined (by freertos.o and gpio.o).

1.报错内容1

Key6\Key6.axf: Error: L6200E: Symbol MX_GPIO_Init multiply defined (by freertos.o and gpio.o).
Key6\Key6.axf: Error: L6200E: Symbol led multiply defined (by freertos.o and gpio.o).
Key6\Key6.axf: Error: L6200E: Symbol HAL_GPIO_EXTI_Callback multiply defined (by freertos.o and gpio.o).
Not enough information to list image symbols.
Not enough information to list the image map.
Finished: 2 information, 0 warning and 3 error messages.
"Key6\Key6.axf" - 3 Error(s), 0 Warning(s).

分析原因:

        频繁提到了.o文件,出现了multiply defined(多重定义),那么就应该想到相互调用导致的多次定义。

解决方法:

        1.导入头文件使用#include“xxxx.h”,注意使用的是.h的文件,不是c文件

        2.定义的数据放入头文件中,不要在.c文件中

例如:以下改为.h(把数据定义放入.h文件)

 

2.报错内容

Key6\Key6.axf: Error: L6200E: Symbol led multiply defined (by gpio.o and main.o).
Key6\Key6.axf: Error: L6200E: Symbol led multiply defined (by freertos.o and main.o).
Not enough information to list image symbols.
Not enough information to list the image map.
Finished: 2 information, 0 warning and 2 error messages.
"Key6\Key6.axf" - 2 Error(s), 0 Warning(s).

本质上与上述一样,都是数据定义的地方出错,定义到.h文件中,并且导入头文件为.h文件即可。

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值