IAR error汇总
无编号警告类型:
1、Sat Jun 23, 2012 17:41:05: The stack pointer for stack 'Stack' (currently Memory:0xF5336) is 原因:https://www.360docs.net/doc/7210519173.html,/s/blog_4c0cb1c0010153l9.html
IAR相关设置:Tools->Option->Stack->Warn when stack pointer is out of bounds.
2、无法查看结构体/共同体/联合体变量[Syntax error, unexpected $end, expecting COLON2] column 1
struct drpoint
{
uint16 x;
uint16 y;
}drpoint[10];
改成:
struct
{
uint16 x;
uint16 y;
}drpoint[10];
参考:https://www.360docs.net/doc/7210519173.html,/group/lpc2000/messages/34213?threaded=1&m=e&var=1&tidx= 1
UESTC 2012.12
IAR 各版本BUG错误修正历史:ftp://https://www.360docs.net/doc/7210519173.html,/pub/efo-ftp/TMP/pub/atmel/_AVR32_MCUs_32bit/Compilers/IAR/IA R_2.20/Install software/EWAVR32-KS-CD-220A/doc/common/doc/CorrectedProblems.pdf
有编号警告类型:
Error[e16]: Segment XDATA_Z (size: 0x19a1 align: 0) is too long for segment definition. At least 0xe4c more bytes needed. The problem occurred while processing the segment placement command
"-Z(XDATA)XDATA_N,XDATA_Z,XDATA_I=_XDATA_START-_XDATA_END", where at the moment of placement the available memory ranges were "XDATA:f1ff-fd53"
Reserved ranges relevant to this placement:
XDATA:f000-f1fe XSTACK
XDATA:f1ff-fd53 XDATA_N
BIT:0-7 BREG
BIT:80-97 SFR_AN
BIT:a8-af SFR_AN
BIT:b8-c7 SFR_AN
BIT:d8-df SFR_AN
BIT:e8-ef SFR_AN
A:
其实这个问题并不是你的程序本身有问题,主要是因为你编写的程序太大了,超出了芯片本身的定义。今天在群里学习了一招,就是将数组定义到code里,我们看一下例子。我们定义一个5100个元素的数组,有以下两种方法:
mermaid提出的方法是:
typedef unsigned char const __code INT8U;
extern INT8U shuzi[5100];
文晶提出的方法是
INT8U code shuzi[5100];
这两种方法其实效果是一致的,定义完数组之后,调用的部分就是需要用指针来调用数组里面的数值了。
Error[e16]: Segment DATA16_I (size: 0xa80 align: 0x1) is too long for segment definition. At least 0x27f more bytes needed. The
pro××em occurred while processing the segment placement command
"-Z(DATA)DATA16_I,DATA16_Z,DATA16_N,HEAP+_HEAP_SIZE=0200-0A00", where at the moment of placement the ××aila××e
memory ranges were "CODE:200-A00"
经过验证是由于RAM耗尽,程序里估计有很大的数据量,最好使用const定义到FLASH里面,问题基本可以解决。
Error[e16]: Segment DATA16_Z (size: 0x6b9 align: 0x1) is too long for segment definition. At least 0x317 more bytes needed. The problem occurred
while processing the segment placement command
"-Z(DATA)DATA16_I,DATA16_Z,DATA16_N,TLS16_I,DATA16_HEAP+_DATA16_HEAP_SIZE=0200-09F F", where at the moment of placement the
available memory ranges were
"CODE:5ce-5ff,CODE:602-605,CODE:609-60b,CODE:60d-60d,CODE:60f-61b,CODE:61e-63f,CODE:6 42-645,CODE:649-64b,CODE:64d-64d,CODE:64
f-65b,CODE:65e-9ff"
Reserved ranges relevant to this placement:
可能的原因:1、设置的某个数组过大,超过了设置的堆栈。
2、设置的堆栈不够大
3、选择的型号不对(编写的程序是用在RAM较大的一个单片机上的,IAR里选择的却是RAM较小的一个型号)
UESTC 2013.3.8
2Q:
烧写程序时无法跳入断点
为什么我每次烧程序都出现:The stack plug-in failed to set a breakpoint on "main". The Stack window will not be able to display stack contents. (You can change this setting in the Tool>Options dialog box.)的警告。但是程序能烧进去,只是不能调试。
A:
确认设置没有问题(和好用的工程相比)这是设置不对,请找下面顺序修改:
iar->options->linker->output->format;
选择Debug information for c-SPY选项
3Q:
错误提示:
Fatal Error[Cp001]: Copy protecTIon check, No valid license found for this product [20]
A:
可以将IAR全部安装上,但是在编译文件时却会报这个错,原因是安装的时候没有把注册机的0x.....字串的小写字母改为大写字母。
4Q:
“Error*e16+: Segment CSTACK (size: 0x50 align: 0x1) is too long for segment definition. At least 0x50 more bytes needed. The problem occurred while processing the segment placement command "-Z(DATA)CSTACK+_STACK_SIZE#", ”
A:
此错误是所定义的全局变量和数组缓冲区等所占的RAM超出硬件支持所致:size: 0x50为超出的大小。只要减少不不要的全局变量和尽量缩小数组缓冲区就可以了!
5Q:
7Q:
Error[Pe018]: expected a ")" C:\Documents and Settings\Administrator\桌面\Crane\Crane\塔吊防碰撞系统1.1版(SIM908 倾角查询)\5438A塔吊防碰撞1.1\api_function.h 5
1、函数或者语句中有变量名复用:
#define length 50 // 吊臂长度
externintdec_to_bcd(intdec_dat, unsigned char *bcd, int length);
将以上的变量名之一换做别的即可解决。
UESTC 2012.3.27
Error[e27]:(变量没有extern声明外部可调用)uestc
https://www.360docs.net/doc/7210519173.html,/s/blog_4c0cb1c00100z0w1.html
Error*e27+: Entry "ER_WARN" in module AD (……) redefined in module FINGERPRINT (……)
解决方法是把变量定义在其中一个cpp文件里面,
然后在另一个文件里面用extern来引用。
sample:
文件一:
int a=0;
文件二:
extern int a; //此处不能使他等于某个数就可以了,如果此处a再赋值extern int a=0;就会报错e27
以为我在x.h文件中定义有变量,然后x.h放入config.h中,config.h被其他的各个.c文件包含,就造成了,x.h中的变量在各个.c中定义,造成了重复定义。UESTC 2012.3.27
相关问答:
https://www.360docs.net/doc/7210519173.html,/u/20120222/22/c9b258d3-f58e-49dc-bf97-630271a26dfc.html
14Q:Error[e46]:
Undefined external "__program_start" referred in ?ABS_ENTRY_MOD ( )
A:该问题应该是IAR设置问题,具体设置如下:
Project->Option->Linker->Config勾选"Override default program"
再选择"Defined by application"
B、static (const)变量是不能被外部文件调用的( ? )
C、只包含了.h文件,.c文件没有添加进工程
从debug切换到release出现错误:release不会自动继承debug的设置,需要自己重新设置:snprintf、fmax、fmin这些函数都能在IAR帮助中找到,但是却出现下面错误:
Error[e46]: Undefined external "fmax" referred in cacu_protect ( C:\Documents and Settings\Administrator\桌面\塔吊安全监控系统-终版\塔吊安全监控系统-终版\
Release\Obj\cacu_protect.r43 )
Error[e46]: Undefined external "fmin" referred in cacu_protect ( C:\Documents and Settings\Administrator\桌面\塔吊安全监控系统-终版\塔吊安全监控系统-终版\
Release\Obj\cacu_protect.r43 )
Error[e46]: Undefined external "snprintf" referred in gprs_8 ( C:\Documents and Settings\Administrator\桌面\塔吊安全监控系统-终版\塔吊安全监控系统-终版\
Release\Obj\gprs_8.r43 )
Error while running Linker
错误原因:链接库的设置不对:
Error[Pe077]:
this declaration has no storage class or type specifier
不同的版本,就有不同的写法,就像环境不一样,中断函数的名字也不一样,我遇到过这样的情况(两个不同版本下定时器初始化时寄存器的名称不同).
如I/O口中断函数的名的两种版本:
版本1:interrupt[PORT2_VECTOR] void PORT2 (void)
版本2:#pragma vector=PORT1_VECTOR
__interrupt void PORT1_ISR (void)
2012.2.x UESTC
8Q:
Error[Pe136]:
struct "
//--------------------------------------------//
afAddrType_tdstAddr;
dstAddr.addrMode = afAddrBroadcast;
dstAddr.addr.shortAddr = 0xFFFF; // 广播发送cdwxl
dstAddr.endpoint = SAMPLEAPP_ENDPOINT; //error所在
//--------------------------------------------//
A:
我们看看afAddrType_t这个结构就明白错在哪里了。
typedefstruct
{
union
{
uint16 shortAddr;
} addr;
afAddrMode_taddrMode;
byteendPoint;
} afAddrType_t;
居然是endPoint大小写错误,Ω 。
9Q:
我最开始也是IAR仿真时找不到main函数,
显示:
Fri Jun 11 14:37:00 2010: Error (col 1): Unknown or ambiguous symbol. main
Fri Jun 11 14:37:01 2010: Error (col 1): Unknown or ambiguous symbol. main
Fri Jun 11 14:37:01 2010: Couldn't go to 'main'.
之后在project==>options==>linker里面的format设成debug,没有这个问题了,但是程序又不能通过TI的那个Flash Programmer下载到板子里了,说是Could not open specified HEX file
A:
这个烧录工具只认release code. 而且扩展名必须是.hex。
所以要用这个烧录工具来烧录必须做两件事:
1. output file设为release version
2. output file 扩展名改为.hex, 默认的是.a51
测试学习阶段可以不用.但产品量产就必须生成二进制文件.
同时programmer还有些其它的功能会常用的
Error[Pe142]: expression must have pointer-to-object type
表达式两边的类型不一样。2012.2.xuestc
例如:
“编译的错误是指第一个‘*’的后面应该是指针,却给了是非指针表达式。
如果p是个指针,那么*(p+i)是p后面第i个域或单元的元素,这个域与p所指的变量类型有关,
也就是说'*(p+i)+j'是数,而非指针。与*结合就错了。”
https://www.360docs.net/doc/7210519173.html,/bbs/bbs_content.jsp?bbs_sn=931945
C++的该错误:
https://www.360docs.net/doc/7210519173.html,/Question/1-4943607/Expression-Must-Pointer-Object-Type-Subscript-Requ ires-Array-Pointer-Type
Error[Pe148]:
variable "TA1R_OVERFLOW" has already been initialized
"unsigned char TA1R_OVERFLOW=0; " 声明可外部调用需要赋值
Error[Pe159]: declaration is incompatible with previous
没加头文件,或者主函数内有子函数,而子函数定义在主函数后边而木有在主函数前声明一下。
Error[Pe169]: expected a declaration
错误原因可能性:
1、void read_gprs_return();
{
……
}
定义函数的时候,结尾多了一个分号:;。
Error[Pe852]:
Error[Pe852]:expression must be a pointer to a complete object type
请教关于结构体数组的引用出错
yanzhongwang
2006-02-24, 14:30
定义结构体数组
var.c:
structStructDisData
{
unsigned intAddrDisData;
unsigned intTypeDisChar;
unsigned intTypeDisUnit;
unsigned char LengthDisData;
};
conststructStructDisDataStrDisData[254]={.....};
var.h:
const extern structStructDisDataStrDisData[254];
在Lunxian.c中引用:
#include "var.h"
unsigned intvAdd;
void Sub1(void)
{
unsigned intdisptr;
disptr =...;
vAdd =StrDisData[disptr].AddrDisData; //编译时在此处出错Error[Pe852]: expression must be a pointer to a complete object type
}
各位大虾请帮我分析一下谢谢!
erlking
2006-02-24, 14:41
改成
vAdd =StrDisData[disptr]->AddrDisData;
试试?
yanzhongwang
2006-02-24, 14:58
谢谢erking这么快的回复!
我改了试了一下还是一样的错误
好像->是用指针方式调用才用到
li_hai_tao930
2006-02-24, 23:19
声明结构体时用typedef定义结构类型名试试
iltgcl
2006-02-27, 08:36
将结构定义
structStructDisData
{
unsigned intAddrDisData;
unsigned intTypeDisChar;
unsigned intTypeDisUnit;
unsigned char LengthDisData;
};
放到头文件中,即.h文件中
yanzhongwang
2006-02-27, 10:59
谢谢楼上的各位!
用iltgcl的方法试了一下编译没问题了!
yanzhongwang
2006-02-27, 11:22
改正后的文件结构如下
var.c:
var.h:
structStructDisData
{
unsigned intAddrDisData;
unsigned intTypeDisChar;
unsigned intTypeDisUnit;
unsigned char LengthDisData;
};
Lunxian.c:
#include "var.h"
unsigned intvAdd;
conststructStructDisDataStrDisData[254]={.....};
void Sub1(void)
{
unsigned intdisptr;
disptr =...;
vAdd =StrDisData[disptr].AddrDisData;
}
再次谢谢各位工程师的热心指点!
readyaiming
2006-03-03, 15:23
不错不错。
Error[Pe260]:
explicit type is missing ("int" assumed) C:\Documents and Settings\Administrator\桌面\下位机\塔吊防碰撞系统1.1版(SIM908 倾角查询)\5438A塔吊防碰撞1.1\LCD(SmallFonts).c 898
问题例子1:定义一个函数,落了红字部分声明
void DrawSector(intx,inty,int R1,int R2,float Ds ,float De,intfill,uchar color)
{
……
}
11Q:Error[Pe513]:
a value of type "int (*)(uint8, uint8)" cannot be assigned to an entity of type "halUARTCBack_t" D:\Program Files\Texas Instruments\ZStack-1.4.3-1.2.1\Components\stack\sapi\sapi.c 968
A:估计是一个函数本没有返回值即void类型,而你却将这个函数赋给了一个int型变量了。。static rxCB( uint8 port,uint8 event )改为
static void rxCB( uint8 port,uint8 event )
12Q:
Fatal Error[e72]: Segment BANK_RELAYS must be defined in a segment definition option (-Z, -b or -P)
A:
使用无线龙的串口互发,发现上述错误,原因是版本太高,具体原因不清,下载一下7.20H 就可以了
Fatal Error[e89]: Too much object code produced (more than 0x1000 bytes) for this package
是4K限制版,请使用有非限制版的。
IAR常见错误请先从如下几方面入手:
1序列号是否正确。
2使用版本是否正确,应该使用7.30B打开的工程文件不能使用7.20H打开。
3尽量不要使用中文路径。
4ZigBee协议栈文件夹需要放在IAR安装盘根目录下。
5请确定当前编译文件夹是否具有读写权限。
6使用的版本是否是限制版
Fatal Error[Pe005]: could not open source file "stdio.h" 这是什么原因?谢谢了
是因为头文件路径不对造成,改正的方法是在设置选项卡的C/C++ Compiler -> Preprocessor 选项里,将$TOOLKIT_DIR$\INC\CLIB\添到Include paths中。($TOOLKIT_DIR$指IAR的安装路径,一般用到标准库函数时要将它写入Include paths里面)
Fatal Error[Pe005]: could not open source file "hal.h" C:\Users\user\Desktop\例子程序\无线通信综合测试\Library\cc2430\HAL\source\setTimer34Period.c 7
先检查C:\Users\user\Desktop\例子程序\无线通信综合测试\Library\cc2430\HAL\source\有无setTimer34Period.c 这个文件,若有,则是因为IAR对中文路径支持不好的缘故,你把这个工程复制到全英文路径下编译应该就不会报错了。
Fatal Error[Pe1696]: cannot open source file "config.h"
注意config.h存放的位置,最好与main同处于一个文件夹
15Q:
Fatal Error[Cp001]:
Copy protection check, No valid license found for this product [24]
XP下装的IAR,到了Win7下出来的问题。
A:这个问题是使用注册机带来的,系统换了,本机ID也要改了。
、、单击IARID.EXE得到本机的ID号
、、右键点Key.cmd,选择编辑,打开,将ID修改为本机ID
、、运行KEY.cmd,在key.txt中的含有EW8051-EV的序列号就是7.30的序列号
16Q:
在用iar debug 下载进已有程序板子出现的
A:将核心板与扩展板分开,只烧写核心板。
17Q:
A:自小峰关于协议栈XDATA溢出的小结
(1)减小程序;
(2)把配置文件f8w2430.xcl/f8w2430pm.xcl中的-D_CODE_END改大点:
********************
f8w2430.xcl:
// CODE
//
// These settings determine the size/location of the ROOT segment.
// Increase _CODE_END to increase ROOT memory, i.e. for constants.
-D_CODE_START=0x0000 // Code size = 128k for CC2430-F128
-D_CODE_END=0x4000 // Last address for ROOT bank
********************
f8w2430pm.xcl:
// CODE
//
// These settings determine the size/location of the ROOT segment.
// Increase _CODE_END to increase ROOT memory, i.e. for constants.
-D_CODE_START=0x0000 // Code size = 128k for CC2430-F128
-D_CODE_END=0x29FF //(原0x28FF) Last address for ROOT bank
Warning[Pe001]: last line of file ends without a newline F:\emoTion\IAR\PK升级\CC1110-8\main.c 179
A:
在使用IAR时常常会弹出类似这样一个警告,其实只要在最后一行多加一个回车就不会再有这个警告了.
6Q:
在编写一个串口程序时:编译没有错,但MAKE时就出现下面的错误
undefined external“UART1_ISR”referred in startup
A:
串口1中断向量没有定义,实际上是串口1中断向量定义其他名称,而不是UART1_ISR.
出现这样的调试IAR错误时:Fatal error: Unknown exception in driver (#E1),是因为IAR软件没有跟Texas Instruments文件放在同一个系统盘下
Warnin[w6]:
Type conflict for external/entry "_A_PORTD", in module _ultrasonic against external/entry in m odule _ST7920; class/struct/union types have
分析:一般Warnin[w6]:问题出在头文件里头,可能有:
1、声明了外部变量,但是用到那个函数的.c文件没有包含那个头文件
2、源代码函数和.h里声明的函数不一样:.c里void XXX(void),头文件中:void XXX();或者:笔误.hz中Wight_warn (); .c中:Weight_warn();
3、在.C中定义了,但是没有extern void clean_uart2_rx_buff();声明外部可调用,然后外部调用了它,就有可能出现。2012.3.26 UESTC
Warning[Pe009]: nested comment is not allowed
注释最好不要嵌套
例如注释1后半部*/
就是最好不要这样uestc
Warning[Pa082]:
undefined behavior: the order of volatile accesses is undefined in this statement
运算符两边都是volatile变量的警告
这警告有意义.
volatile 意思是:易变的。
用volatile修饰的变量一般不直接参与运算(在运算中值可能在变化),volatile就以为这个变量在运算过程中有可能已经改变了
例如:想计算a * b 要这样:
volatile unsigned char a;
volatile unsigned char b;
unsigned char x,y;
x = a;
y = b;
return (x * y);
复制代码
建议使用另外一个变量参与计算:
volatile char VVV = 9;
char fun()
{
char xxx;
char yyy = 9;
xxx = VVV;
return xxx * yyy
}
复制代码
Warning[Pe175]:
编译错误:Warning[Pe175]: subscript out of range
原因:定义了float value[6] ;既我们定义的了value[0]、value[1]……value[5],默认从0开始的,而实际中我们用到了value[6],越界了。
2011年6月2日
Warning[Pe177]:
function "rxCB" was declared but never referenced D:\Program Files\Texas Instruments\ZStack-1.4.3-1.2.1\Components\stack\sapi\sapi.c 982
A:函数虽定义但从未被引用(使用)。如果你需要使用该函数,就需要检查;否则略过。13Q:
Fri Jun 11 14:37:00 2010: Error (col 1): Unknown or ambiguous symbol. main
Fri Jun 11 14:37:01 2010: Error (col 1): Unknown or ambiguous symbol. main
Fri Jun 11 14:37:01 2010: Couldn't go to 'main'.
A:project==>options==>linker 看看里面的format是不是设成debug
详见https://www.360docs.net/doc/7210519173.html,/bbs/viewthread.php
Warning[Pe186]: pointless comparison of unsigned integer with zero
无符号整数不可能小于0的……
10Q:Warning[Pe188]:
enumerated type mixed with another type D:\Program Files\Texas Instruments\ZStack-1.4.3\Projects\zstack\Samples\SampleApp\Source\SampleApp.c 206
A:SampleApp_Periodic_DstAddr.addrMode = Addr16Bit;//(afAddrMode_t)afAddrGroup; typedefenum
{
afAddrNotPresent = AddrNotPresent,
afAddr16Bit = Addr16Bit,
afAddrGroup = AddrGroup,
afAddrBroadcast = AddrBroadcast
} afAddrMode_t;
问题就在于Addr16Bit未加afAddrMode_t这个套子。
Warning[Pe1072]: a declaration cannot have a label
在switch case:后直接定义变量了
switch (check_storce_status())
{
case 0:
break;
case 1:
intfash;
break;
case 2:
break;
}
解决方法:
前后加个括号即可。
switch (check_storce_status())
{
case 0:
break;
case 1:
{
intfash;
break;
}
case 2:
break;
}
UESTC 2012.3.19
Fatal Error[Pe1696]:
Fatal Error[Pe1696]: cannot open source file "time.h" C:\Documents and Settings\Administrator\桌面\塔吊安全监控系统-终版\塔吊安全监控系统-终版\config.h 53
searched: "C:\Documents and Settings\Administrator\桌面\塔吊安全监控系统-终版\塔吊安全监控系统-终版\"
searched: "C:\Program Files\IAR Systems\Embedded Workbench 6.0 Evaluation_0\430\inc\clib\" searched: "C:\Program Files\IAR Systems\Embedded Workbench 6.0 Evaluation_0\430\inc\"
Error while running C/C++ compiler
出错原因是编译器在上面列出的路径内的文件夹下面找不到time.h
首先确定是不是真的存在这两个头文件(没有就自行下载或者编写吧)。然后可以采取以下两种解决方法:
1、include时写上完整的路径名。如:
#include "D:\headers\msp430x14x.h"
2、在编译器的默认头文件路径中添加你自定义的头文件存放路径。一般是你所用的IDE的某项功能,这就看你用的是什么IDe了。
3、将头需要的头文件复制到编译器搜索的目录(一般debug能通过,release通不过的时候多是这个原因):
第一步:找头文件所在的地方
第二步:复制(另存为)到IAR 搜索的目录:
searched: "C:\Program Files\IAR Systems\Embedded Workbench 6.0 Evaluation_0\430\inc\clib\"
UESTC 2013.3.11
18.2 编译警告消息
下表列出了编译警告消息
编号警告消息建议
0 Macro ‘name’ redefined 宏‘name’被重新定义
用#define 定义的符号被用不同的参数或形式表重新定义
1 Macro formal partameter ‘name’ is never referenced 宏形式参数‘name’被重新定义
#define 形式参数从未在参数字符串中出现
2 Macro ‘name’ is already#undef宏
‘name’被重新定义
#undef被用于不是宏观的符号
3 Macro ‘name’ called with empty parameter(s) 用空参数调用宏‘name’用零长度(zero-length)的参数不清调
用在#define 中定义的参数化宏观
4 Macro ‘name’ is called recursively;
not expanded 宏‘name’ 被递归调用不扩展
递归宏调用使预处理器停止该宏的进一步扩展
5 Undefined symbol ‘name’ in #if or
#elif; assumed zero 在#if 或#elif
中未定义的符号‘name’;假设为零
在#if 或#elif表达式中把非宏符号作
为零来处理被认为是错误的编程实践使用以下两个中任一个#ifdef symbol
或#if defined(symbol)
6 Unkown escape seguence ‘\c’ ;assume’c’未知的转义序列‘\c’ 假设为’c’
在字符常数中发现反斜杠\ 或字符
文字后随未知的转义字符
7 Nested comment found without using the’c’ option 发现嵌套的注释未使用’c’选项
在注释中发现字符序列
无条件转移或返回在一条或多条语名之前使得这条或多条语句从来不会被执行
21 Unreachable statement(s) at unreachable label ‘name’ 在未卜先知
被引用的标号‘name’处不能到达的语句例如
Break;
Here:
I=2;
无条件转移或返回在有标号的一条或多条语句之前但是标号从未被引用所
以这条或多余语句从来不会被执行
22 Non-void function: explicit “return”
显式的“return”<表达式>被预期
非空non-void 函数产生隐含返回
这可能是从循环或开关语句中非预期的退出注意不带default 的开关语句
总是被编译器当作可退出的而不管
case 的结构如何
23 Undeclared function ‘name’; assumed
“extern” “int” 未声明的函数‘name’;
假设为“extern” “int”
对未声明函数的引用导致使用缺省的声
明函数被假设为具有K&R 类型具有
外部存储类别并返回int整型
24 Static memory option converts local
“auto” or “register” to “static”(静
态存储器选项把局部“auto”或
“register”转换为“static”)
用于静态存储器分配的命令行选项使
auto 自动和register 寄存器声
明被当作static 静态来处理
25 Inconsistent use of K&R functionvarying
number of parameters(K&R 函
数的不一致使用-改变了参数的数目)
用改变了的参数类型调用K&R 函数
26 Inconsistent use of K&R functionchanging
type of parameter K&R 函数
用改变了的参数类型调用K&R 函数
MSP430 系列C 编译器编程指南
利尔达电子中国有限公司TEL 0571-******** FAX 0571-******** - 116 - 的不一致使用改变了参数的类型
例如
myfunc(34);
myfunc(34.6);
27 Size of “extern” object ‘name’ is
unknown 外部对象‘name’的大小未知
Extern 外部数组应当用size 声明
28 Constant [index] outside array bound
常数[索引]超出数组边界
存在超出已声明数组边界的常数索引
29 Hexadecimal escape sequence larger
than “char” 十六进制转义序列大于
“char”
转义序列被截断以适合于放入char 字
符中
30 Attribute ignored 属性被忽略
例子
因为const常量或volatile 易失
的是对象的属性所以当它们与
structure 结构,union 联合或
enumeration(枚举)标签定义一起给出
时将被忽略上述定义没有和对象同时
声明而且函数被认为不能返回const
或volatile
31 Incompatible parameters of K&R
functions K&R 函数的参数不兼容在
下列范围之一使用指针
指向函数的指针可能是间接的或K&R
函数声明具有不兼容的参数类型
32 Incompatible numbers parameters of
K&R functions(K&R 函数的参数数目不兼
容)在下列范围之一使用指针
指向函数的指针可能是间接的或K&R
函数声明具有不同数目的参数
33 Local or formal ‘name’ was never 在函数定义中未使用形式参数或局部变referenced(局部或形式参数‘name’从未被引用)
量对象
34 Non-printable character ‘\xhh’ found
in literal or character constant 在
文字或字符常数中发现不可打印字符号
‘\xhh’
在字符串文字或字符常数中使用不可打
印non-printable 字符被认为是一
种不好的编程习惯为了得到同样的结
果可使用‘\0xhhh’
35 Old-style(K&R) type of function
declarator (老式(K&R)类型的函数声明)
发现老式(K&R)函数声明只有正在使
用-gA选项时才发出这种警告
36 Floating point constant out of
range(浮点常数超出范围)
浮点值太大或太小以致不能使用目标的
浮点系统来表示
37 Illegal float operation :division by
zero not allowed(非法浮点运算不允
许除以零)
在常数算术运算时发现除零
38 Tag identifier ‘name’ was never
defined(从未定义标签识别符‘name’)
39 Dummy statement. Optimized away! 发现多余的代码这通常表示用户代码中打印错误或可能产生于使用有点不太
通用的宏时这不是错误
例如
a+b