今天移植代码时遇到一个比较奇葩的问题,记录如下:

Error[Li006]: duplicate definitions for "Uart3"; in "E:\IAR_1768Pro_PCB799\Debug\Obj\Uart3_init.o", and "E:\IAR_1768Pro_PCB799\Debug\Obj\uModemG600.o"

重复定义 变量 Uart3

可是,uModemG600.c 文件中没有 Uart3 这个变量 ,只有 uart3.h 这个头文件,问题就出现在在这头文件中。

Uart3 这个变量的定义就放在 uart3.h 中,而且 uart3.h 在uart3.c 和 uModemG600.c 中都有#include , uart3.h 也未做条件编译,导致uart3.h 重复编译, 变量重复定义。

//===================问题描述完毕,一下是个人观点======================

我个人的做法是,变量/函数 定义在 *.c 文件中,变量/函数声明在 *.h 文件中, 并且 *.h 文件加编译条件,放置重复包含,格式如下:

user.c

 //user.c file

 #include <stdio.h>
#include <string.h>
#include "user.h" signed char g_a = ;
unsigned char g_b = ;
signed int g_c = ; void fun1(void)
{
//do something
} void fun2(void)
{
//do something
}

user.h

#ifndef _USER_H_
#define _USER_H_ extern signed char g_a;
extern unsigned char g_b;
extern signed int g_c; void fun1(void);
void fun2(void); #endif

IAR ERROR --- [Li006]的更多相关文章

  1. Error[Li006]: duplicate definitions for "******"

    今天参考别人程序写程序时出现Error[Li006]: duplicate definitions for "******". 参考程序中将变量和数据定义在(.h)文件中,我也就直 ...

  2. IAR:Error [Li005]:no definition for"***" 问题之连接

    对于 IAR 出现的 Error[Li005] 链接错误,网上已经给出了比较详尽的解决方法,而对于这次记录,主要是记录解决问题的思路. 网上给出的方法:http://blog.csdn.net/yue ...

  3. Keil和IAR——使用笔记

    1. 几个宏的定义 Keil和IAR均用到以下三种宏定义,分别是:USE_STDPERIPH_DRIVER——表示使用ST提供的标准外设固件库:STM32F40_41xxx——作为芯片的判断:VECT ...

  4. IAR EWAR 内联汇编 调用外部函数 Error[Og005], Error[Og006]

    How do I call a C function in another module from inline assembler in IAR EWARM? I have a bit of ass ...

  5. IAR EWAR 内联汇编 Error[Og010], Error [Og005], Error [Og006]

    Error [Og005] + [Og006] when using inline assembler EW targets: 430, ARM, AVR EW component: C/C++ co ...

  6. IAR FOR STM8S 错误 An error occurred while retrieving GDI features: gdi-error [40201]解决方法

    今早使用IAR调试编译调试一个工程,发现IAR竟然出现如下错误信息 An error occurred ]: Can't access configuration database 在网上查看了一下, ...

  7. STM32+IAR 解决Error[Pe147]: declaration is incompatible with "__nounwind __interwork __softfp unsigned

    在IAR中编译STM32工程,遇到 Error[Pe147]: declaration is incompatible with "__nounwind __interwork __soft ...

  8. IAR 编译错解决Error[e16]: Segment NEAR_Z (size: 0x16d align: 0) is too long for segment definition. At least 0x83 more bytes needed.

    Error[e16]: Segment NEAR_Z (size: 0x16d align: 0) is too long for segment definition. At least 0x83 ...

  9. IAR错误Error[e16]: Segment ISTACK (size: 0xc0 align: 0) is too long for segment definition. At least 0xd more bytes needed. The problem occurred while processing the segment 的解决办法

    IAR for 8051 IDE version 9.10.1编译阿莫单片机的cc2541程序osal第一节教程出现错误如下 出错的愿意是iar设置错误.所以需修改IAR的设置. 解决办法如下: 即可 ...

随机推荐

  1. pt-online-schema-change原理解析 博客相关需要阅读

    xiaoboluo768  http://www.lai18.com/user/481193.html   都说pt-toolkit工具集中的pt-online-schema-change可以在线不锁 ...

  2. subline的安装

    简单的安装方法 使用Ctrl+`快捷键或者通过View->Show Console菜单打开命令行,粘贴如下代码: import urllib.request,os; pf = 'Package ...

  3. 利用正则表达式作为string.split seprator

    某字符串 var str = "{1,att,7},{2,break,7},{3,crit,7},{4,combo,7},{5,break,7},{6,hit,7}"; 需要分割成 ...

  4. Pass value from child popup window to parent page window using JavaScript--reference

    Here Mudassar Ahmed Khan has explained how to pass value from child popup window to parent page wind ...

  5. Eclipse launch failed.Binary not found解决方案

    配置完成后建立工程测试,发现建立Hello World c++ Project类型的项目后可以运行测试,直接建立空项目写个测试类无法运行,提示"launch failed.Binary no ...

  6. css笔记03:伪类first-child

    1. 匹配第一个 <p> 元素 在下面的例子中,选择器匹配作为任何元素的第一个子元素的 p 元素: <html> <head> <style type=&qu ...

  7. HTTP协议理解

    HTTP(Hyper Text Transfer Protocol)超文本传输协议,是一种请求响应式协议,类似两国会晤中需要遵守的规则.那么,其中有什么内容特点呢? HTTP特点: 1)支持客户端/服 ...

  8. 虚拟机中Ubuntu设置固定IP方法

    --2013年7月29日20:39:16 场景:在搭建hadoop分布式系统的时候,每次重启节点,节点对应的ip发生变化,现在需要将每个节点绑固定的ip --原理: 设置节点用的网卡->绑定ip ...

  9. CSS3秘笈第三版涵盖HTML5学习笔记6~8章

    第二部分----CSS实用技术 第6章,文本格式化 指定备用字体: font-family:Arial,Helvetica,sans-serif; 当访问者没有安装第一种字体时,浏览器会在列表中继续往 ...

  10. js限制文本框输入字数

    //js代码 <script type="text/javascript"> function checkLen(term){ document.all.termLen ...