问题

今天督促队友写代码,他反馈移植的OELD代码报错Symbol oled_pow multiply defined。我查看了一下,发现在main.c和SR04.c中都引用了OLED(#include "oled.h")。如果将超声波代码里面的#include "oled.h"注释掉就没有报错了,我查看了他头文件,发现加上了#ifndef __OLED_H_#define __OLED_H_#endif。测试了几次还是一大堆的Symbol oled_pow multiply defined 报错。

报错

Robot_competition\Robot_competition.axf: Error: L6200E: Symbol F6x8 multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol F8X16 multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol Hzk multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol BMP multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol BMP1 multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol BMP2 multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol BMP3 multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol IIC_Start multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol IIC_Stop multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol IIC_Wait_Ack multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol OLED_Clear multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol OLED_Display_On multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol OLED_DrawBMP multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol OLED_GPIO multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol OLED_Init multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol OLED_Set_Pos multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol OLED_ShowCHinese multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol OLED_ShowChar multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol OLED_ShowNum multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol OLED_ShowString multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol OLED_WR_Byte multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol Write_IIC_Byte multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol Write_IIC_Command multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol Write_IIC_Data multiply defined (by main.o and sr04.o).
Robot_competition\Robot_competition.axf: Error: L6200E: Symbol oled_pow multiply defined (by main.o and sr04.o).

尝试过程

(1)于是我开始加入extern关键字,发现依旧无用。
(2)然后我就开始查看他的OLED代码,发现OLED代码似乎也没有问题。
(3)然后我突然想到了去字模库看看。后面发现,他将所有的字模变量定义都放在了.h文件。
(4)然后我突然想起我也遇到过类似的问题,然后搜索了一下,在头文件定义变量有什么问题。结果是得到: 头文件中不可以放变量的定义 ! 一般头文件中只是放变量的声明,因为头文件要被其他文件包含#include,如果把定义放在头文件的话,就不能避免多次 定义变量 。

结论

我们的OLED字模变量定义应该放在.C文件中,而不是.h文件。只需要把.h文件剪切到.C文件即可。

关于OLED移植出现Symbol oled_pow multiply defined相关推荐

  1. STM32编程这种错误(Error: L6200E: Symbol USART_Config multiply defined (by bsp_usart.o and bsp_dma_m)解决方法

    前几天在移植程序的时候碰到Error: L6200E: Symbol USART_Config multiply defined (by bsp_usart.o and bsp_dma_mtp.o)这 ...

  2. Symbol xxx multiply defined (by xxx1.o and xxx2.o).

    在stm32systick学习中,systick.h中写了如下代码: #ifndef SYSTICK_H #define SYSTICK_H#include"stm32f10x.h" ...

  3. STM32串口调试 出现Symbol XXX multiply defined (by uart.o and main.o). ERRO:L6200E

    (STM32串口调试 出现Symbol XXX multiply defined (by uart.o and main.o).) 关于Symbol XXX multiply defined (by ...

  4. MDK Keil5创建stm32工程出现 Error: L6200E: Symbol HAL_MspDeInit multiply defined

    MDK Keil5创建stm32工程出现 -\OBJ\Template.axf: Error: L6200E: Symbol HAL_MspDeInit multiply defined(bystm3 ...

  5. symbol xxx multiply defined

    问题描述:因为要使用CAN进行数据传输,因此在主程序"test.c"中采用#include "can.h",调用"can.h"中的函数和变量 ...

  6. Symbol SWI2_EGU2_IRQHandler multiply defined(by nrf_sdh_freertos.o and nrf_sdh.o)

    现象描述 ._build\nrf52840_xxaa.axf: Error: L6200E: Symbol SWI2_EGU2_IRQHandler multiply defined (by nrf_ ...

  7. ..\OBJ\ZYBS.axf: Error: L6200E: Symbol EXTI0_IRQHandler multiply defined (by exti.o and wkup.o).

    错误的原因可能是在项目中相同的函数在不同的文件中被应用所报错: -\OBJ\ZYBS.axf: Error: L6200E: Symbol EXTI0_IRQHandler multiply defi ...

  8. static变量在处理stm32单片机程序报错“Error: L6200E: Symbol cntdata multiply defined (by timer.o and main.o”问题的应用

    一.原程序及错误提示 1)头文件timer.h: #ifndef _TIMER_H #define _TIMER_H #include "sys.h" u8 cntdata=0; ...

  9. 【琐琐碎碎小知识】Keil5编译时候出现 Error: L6200E: Symbol HAL_MspDeInit multiply defined事故处理

    文章目录 问题描述 问题解决 产生问题的原因 问题描述 出现的问题在底部打印出现的报错信息大致是这种的: multiply defined大致可以翻译为重复定义 问题解决 ① 找到自己将ST官方提供的 ...

最新文章

  1. 基于AWS-ELK部署系统日志告警系统
  2. MySQL复习资料(八)——MySQL-事务
  3. Leaf服务器框架从入门到放弃(一)认识Leaf和安装Leaf环境
  4. (1)定义一个抽象类Weapon,该抽象类有两个抽象方法attack(),move() 这两个方法分别表示武器的攻击方式和移动方式。 (2)定义3个类:Tank,Fl
  5. 程序员怎样学习python_一个开发十年的程序员论:学习Python最正确的步骤(0基础必备)...
  6. Rust: 镜像设置要注意影响效果
  7. Analysis::checkMerge2Nx2N_rd0_4()
  8. 基于JAVA开发的在线双人联机坦克大战小游戏
  9. STM32 rtc唤醒 低功耗待机模式 避免iwdog看门狗方案
  10. 关于vue创建项目失败的原因
  11. 考研数学模拟题要选哪个当真题做
  12. 密码编码学与网络安全(第五版)答案
  13. python数据可视化例子
  14. LaTeX 常用符号命令大全
  15. 分享关于网站跳出率需要控制在多少
  16. 评分的游戏:Uber是如何将乘客变成可怕的boss的?
  17. JAVA衣依服装销售平台计算机毕业设计Mybatis+系统+数据库+调试部署
  18. 内网安全-域横向CobaltStrikeSPNRDP
  19. innodb buffer pool管理--free list
  20. 草根IT对博客模板MaterialDesign的优化

热门文章

  1. linux mint kde 中文输入法,Linux Mint KDE上安装fcitx+sougou输入法
  2. 【对当前现状的分析】如何做好学术汇报的PPT?
  3. 微型计算机首先同用户打交道,一级计算机模拟考试题自编.docx
  4. php自动生成新闻页,PHP静态新闻列表自动生成代码
  5. 突发!百度总裁张亚勤宣布退休
  6. 小伙发明黑科技插座:水中拔插头不触电
  7. 如何将Ubuntu安装 到移动硬盘--操作系统随身携带
  8. DatabaseMetaData,ResultSet,ResultSetMetaData
  9. 全面理解PLC如何转换处理模拟量信号
  10. 大佬们争相入局!100W年薪招揽区块链技术人才