ICCAVR常见错误推荐.pdf
10页新手用 ICC 编程的时候,经常会出现一些错误,现在将常见的错误报告整理如下这里的一些错误是我为了展示而故意制造的,欢迎你提供你遇到的错误排名不分先后:一、正常编译通过CODE:C:iccbinimakew-f main.makiccavr -c-e -DATMEGA-DATMega16-l -g -Mavr_enhanced桌面 实验教程 LED 应用 霓虹灯 main.ciccavr-omain-g -ucrtatmega.o-bfunc_lit:0 x54.0 x4000-dram_end:0 x45f-bdata:0 x60.0 x45f-dhwstk_size:16-beeprom:1.512-fihx_coff-S2 main.lk-lcatmegaDevice 1% full.Done.Copy to clipboard这是我们最想看到的了,万事大吉二、工程中未加入.C 文件CODE:C:iccbinimakew-f main.makiccavr-omain-g -ucrtatmega.o-bfunc_lit:0 x54.0 x4000-dram_end:0 x45f-bdata:0 x60.0 x45f-dhwstk_size:16-beeprom:1.512-fihx_coff-S2 main.lk-lcatmegaunknownfile type main.lk,passed to linker!ERRORunknownfile type main.lkC:iccbinimakew.exe:Error code 1Done: there are error(s). Exit code: 1Copy to clipboard解决办法:将你的程序加入工程中,可以右键程序区ADD to project三、程序没有后缀名,或者后缀名不正确。
CODE:C:iccbinimakew-f main.makC:iccbinimakew.exe:main is up to dateDone.Copy to clipboard这是一个很难理解的错误,它是由工程中的程序文件没有后缀名造成的解决办法: 将原有文件移出工程,将文件的后缀名改为.C,然后再加入工程中四、没有main 函数CODE:C:iccbinimakew-f main.makiccavr -c-e -DATMEGA-DATMega16-l -g -Mavr_enhanced桌面 实验教程 LED 应用 霓虹灯 main.ciccavr-omain-g -ucrtatmega.o-bfunc_lit:0 x54.0 x4000-dram_end:0 x45f-bdata:0 x60.0 x45f-dhwstk_size:16-beeprom:1.512-fihx_coff-S2 main.lk-lcatmega!ERRORfile crtatmega.o:undefinedsymbol _mainC:iccbinimakew.exe:Error code 1Done: there are error(s). Exit code: 1Copy to clipboard解决办法,编写程序主函数MAIN 。
五、没有选择目标芯片出现如下错误:CODE:C:iccbinimakew-f main.makiccavr -c-e -l -g -Wa-W桌面 实验教程 LED 应用 霓虹灯 main.ciccavr-omain-g-Wl-W-bfunc_lit:0.0 x2000-dram_end:0 x25f-bdata:0 x60.0 x25f-dhwstk_size:16-beeprom:1.512-fihx_coff-S2 main.lk!E C:icclibcrtAVR.o(41):Code address 0 already containsa value!E C:icclibcrtAVR.o(41):Code address 0 x1 already containsa valueC:iccbinimakew.exe:Error code 1Done: there are error(s). Exit code: 1Copy to clipboard解决办法: projectOptionstargetdeviceconfiguration选择合适的芯片六、缺少分号CODE:C:iccbinimakew-f main.makiccavr -c-e -DATMEGA-DATMega16-l -g -Mavr_enhanced桌面 实验教程 LED 应用 霓虹灯 main.c!E桌面 实验教程 LED 应用 霓虹灯 main.c(52):unrecognizedstatement!E桌面 实验教程 LED 应用 霓虹灯 main.c(53):syntax error; found expecting;!E桌 面实 验 教 程 LED 应 用霓 虹 灯 main.c(53):syntaxerror; foundend of inputexpectingC:iccbinimakew.exe:Error code 1C:iccbinimakew.exe:main.o removed.Done: there are error(s). Exit code: 1Copy to clipboard上面的报告说明了第52 行缺少一个分号,预期分号的地方出现了“ ” 。
解决方法,在52 行末尾添加分号类似的有:缺少的报错CODE:C:iccbinimakew-f main.makiccavr -c-e -DATMEGA-DATMega16-l -g -Mavr_enhanced桌面 实验教程 LED 应用 霓虹灯 main.c!E桌面 实验教程 LED 应用 霓虹灯 main.c(55):illegal statementtermination!E桌面 实验教程 LED 应用 霓虹灯 main.c(55):skipping void!W桌 面实 验 教 程 LED 应 用霓 虹 灯 main.c(55):warningcallingfunctionwithoutprototypemay cause errors!E桌面 实验教程 LED 应用 霓虹灯 main.c(56):syntax error; found expecting;!E桌 面实 验 教 程 LED 应 用霓 虹 灯 main.c(57):syntaxerror; foundend of inputexpectingC:iccbinimakew.exe:Error code 1C:iccbinimakew.exe:main.o removed.Done: there are error(s). Exit code: 1Copy to clipboard七:变量没有定义CODE:C:iccbinimakew-f main.makiccavr -c-e -DATMEGA-DATMega16-l -g -Mavr_enhanced桌面 实验教程 LED 应用 霓虹灯 main.c!E桌面 实验教程 LED 应用 霓虹灯 main.c(48):undeclaredidentifieriC:iccbinimakew.exe:Error code 1C:iccbinimakew.exe:main.o removed.Done: there are error(s). Exit code: 1Copy to clipboard解决办法:在程序开始前添加变量定义,比如unsignedchar i;注意,定义变量要在函数的最前面进行,及在进行计算操作之前定义所有变量。
第 1 楼 :回复主题: ICCAVR 报错集锦发布时间: 2008-2-25下午 5:00提问者: Williams感谢小飞 一凡提供下面的内容E touchpad.c(67):unrecognizedstatement!E touchpad.c(68):syntax error; found void expecting;上一行缺少 “ ;” 号所致W touchpad.c(325):warningcallingfunction withoutprototypemay cause errors 没有在头文件中添加调用的函数库!E E:ICCAVRiccuser001main.c(100):undeclaredidentifiertemp 错误:变量temp 未声明!E D:iccavr6.31.AicclibcrtAVR.(41):Codeaddress0 already containsa value!E D:iccavr6.31.AicclibcrtAVR.(41):Codeaddress0 x1 already containsa value没有选择芯片型号E library(31)area text not large enough 程序空间不够。
E _3Q0.AAA(0):area data not large enough内存不足C:/icc/include/iom8v.h(18):D:icc 圆织机程序 8.c(288):Macro redefinitionof TWBR 重复定义 TWBRcalling function without prototypemay cause errors 没有 extern 声明!E lianxi.o(103):multiple define: _mainmain 函数重复了,应该只能有一个main.warningdeclaringa functionwithout prototypemay cause errors 函数原型没有声明你调用的某个函数没有声明Ambiguousoperatorsneed parentheses不明确的运算需要用括号括起Ambiguoussymbol xxx不明确的符号Argumentlist syntax error参数表语法错误Array bounds missing丢失数组界限符Array size toolarge数组尺寸太大Bad characterin paramenters参数中有不适当的字符Bad file name format in include directive包含命令中文件名格式不正确Bad ifdef directivesynatax编译预处理ifdef 有语法错Bad undef directivesyntax编译预处理undef 有语法错Bit field too large位字段太长Call of non-function调用未定义的函数Call to function with no prototype调用函数时没有函数的说明Cannot modify a const object不允许修改常量对象Case outside of switch漏掉了 case语句Case syntax errorCase语法错误Code has no effect代码不可述不可能执行到Compoundstatementmissing分程序漏掉 Conflictingtype modifiers不明确的类型说明符Constantexpressionrequired要求常量表达式Constantout of range in comparison在比较中常量超出范围Conversionmay lose significantdigits转换时会丢失意义的数字Conversionof near pointer not allowed不允许转换近指针Could not find file xxx找不到 XXX 文件Declarationmissing; 说明缺少 ; 小 飞 一 凡 (490152151)12:03:21很 多人用它 。





