您好,欢迎访问三七文档
当前位置:首页 > IT计算机/网络 > 其它相关文档 > iccavr编译时出现的错误解决办法
初学者初用ICCAVR编程的时候,经常会出现一些错误,现在将常见的错误报告整理如下。这里的一些错误是为了展示说明而故意制造的,欢迎你提供你遇到的错误和解决方法。一、正常编译通过CODE:C:\icc\bin\imakew-fmain.makiccavr-c-IC:\icc\include\-e-DATMEGA-DATMega16-l-g-Mavr_enhancedD:\桌面\实验教程\LED应用\霓虹灯\main.ciccavr-omain-LC:\icc\lib\-g-ucrtatmega.o-bfunc_lit:0x54.0x4000-dram_end:0x45f-bdata:0x60.0x45f-dhwstk_size:16-beeprom:1.512-fihx_coff-S2@main.lk-lcatmegaDevice1%full.Done.[url=][/url]这是我们最想看到的了,万事大吉。二、工程中未加入.C文件CODE:C:\icc\bin\imakew-fmain.makiccavr-omain-LC:\icc\lib\-g-ucrtatmega.o-bfunc_lit:0x54.0x4000-dram_end:0x45f-bdata:0x60.0x45f-dhwstk_size:16-beeprom:1.512-fihx_coff-S2@main.lk-lcatmegaunknownfiletype@main.lk,passedtolinker!ERRORunknownfiletype'@main.lk'C:\icc\bin\imakew.exe:Errorcode1Done:thereareerror(s).Exitcode:1解决办法:将你的程序加入工程中,可以右键程序区ADDtoproject三、程序没有后缀名,或者后缀名不正确。CODE:C:\icc\bin\imakew-fmain.makC:\icc\bin\imakew.exe:'main'isuptodateDone.这是一个很难理解的错误,它是由工程中的程序文件没有后缀名造成的。解决办法:将原有文件移出工程,将文件的后缀名改为.C,然后再加入工程中。四、没有main函数CODE:C:\icc\bin\imakew-fmain.makiccavr-c-IC:\icc\include\-e-DATMEGA-DATMega16-l-g-Mavr_enhancedD:\桌面\实验教程\LED应用\霓虹灯\main.ciccavr-omain-LC:\icc\lib\-g-ucrtatmega.o-bfunc_lit:0x54.0x4000-dram_end:0x45f-bdata:0x60.0x45f-dhwstk_size:16-beeprom:1.512-fihx_coff-S2@main.lk-lcatmega!ERRORfile'crtatmega.o':undefinedsymbol'_main'C:\icc\bin\imakew.exe:Errorcode1Done:thereareerror(s).Exitcode:1解决办法,编写程序主函数MAIN。五、没有选择目标芯片出现如下错误:CODE:C:\icc\bin\imakew-fmain.makiccavr-c-IC:\icc\include\-e-l-g-Wa-WD:\桌面\实验教程\LED应用\霓虹灯\main.ciccavr-omain-LC:\icc\lib\-g-Wl-W-bfunc_lit:0.0x2000-dram_end:0x25f-bdata:0x60.0x25f-dhwstk_size:16-beeprom:1.512-fihx_coff-S2@main.lk!EC:\icc\lib\crtAVR.o(41):Codeaddress0alreadycontainsavalue!EC:\icc\lib\crtAVR.o(41):Codeaddress0x1alreadycontainsavalueC:\icc\bin\imakew.exe:Errorcode1Done:thereareerror(s).Exitcode:1解决办法:projectOptionstargetdeviceconfiguration选择合适的芯片。六、缺少分号CODE:C:\icc\bin\imakew-fmain.makiccavr-c-IC:\icc\include\-e-DATMEGA-DATMega16-l-g-Mavr_enhancedD:\桌面\实验教程\LED应用\霓虹灯\main.c!ED:\桌面\实验教程\LED应用\霓虹灯\main.c(52):unrecognizedstatement!ED:\桌面\实验教程\LED应用\霓虹灯\main.c(53):syntaxerror;found`}'expecting`;'!ED:\桌面\实验教程\LED应用\霓虹灯\main.c(53):syntaxerror;found`endofinput'expecting`}'C:\icc\bin\imakew.exe:Errorcode1C:\icc\bin\imakew.exe:'main.o'removed.Done:thereareerror(s).Exitcode:1上面的报告说明了第52行缺少一个分号,预期分号的地方出现了“}”。解决方法,在52行末尾添加分号。类似的有:缺少}的报错CODE:C:\icc\bin\imakew-fmain.makiccavr-c-IC:\icc\include\-e-DATMEGA-DATMega16-l-g-Mavr_enhancedD:\桌面\实验教程\LED应用\霓虹灯\main.c!ED:\桌面\实验教程\LED应用\霓虹灯\main.c(55):illegalstatementtermination!ED:\桌面\实验教程\LED应用\霓虹灯\main.c(55):skipping`void'!WD:\桌面\实验教程\LED应用\霓虹灯\main.c(55):[warning]callingfunctionwithoutprototypemaycauseerrors!ED:\桌面\实验教程\LED应用\霓虹灯\main.c(56):syntaxerror;found`{'expecting`;'!ED:\桌面\实验教程\LED应用\霓虹灯\main.c(57):syntaxerror;found`endofinput'expecting`}'C:\icc\bin\imakew.exe:Errorcode1C:\icc\bin\imakew.exe:'main.o'removed.Done:thereareerror(s).Exitcode:1七:变量没有定义CODE:C:\icc\bin\imakew-fmain.makiccavr-c-IC:\icc\include\-e-DATMEGA-DATMega16-l-g-Mavr_enhancedD:\桌面\实验教程\LED应用\霓虹灯\main.c!ED:\桌面\实验教程\LED应用\霓虹灯\main.c(48):undeclaredidentifier`i'C:\icc\bin\imakew.exe:Errorcode1C:\icc\bin\imakew.exe:'main.o'removed.Done:thereareerror(s).Exitcode:1解决办法:在程序开始前添加变量定义,比如unsignedchari;注意,定义变量要在函数的最前面进行,及在进行计算操作之前定义所有变量。八:其他错误!Etouchpad.c(67):unrecognizedstatement!Etouchpad.c(68):syntaxerror;found`void'expecting`;'上一行缺少“;”号所致。!Wtouchpad.c(325):[warning]callingfunctionwithoutprototypemaycauseerrors没有在头文件中添加调用的函数库!EE:\ICCAVR\icc\user001\main.c(100):undeclaredidentifier`temp'错误:变量'temp'未声明!ED:\iccavr6.31.A\icc\lib\crtAVR.(41):Codeaddress0alreadycontainsavalue!ED:\iccavr6.31.A\icc\lib\crtAVR.(41):Codeaddress0x1alreadycontainsavalue没有选择芯片型号。!Elibrary(31)area'text'notlargeenough程序空间不够。?!E_3Q0.AAA(0):area'data'notlargeenough内存不足C:/icc/include/iom8v.h(18):D:\icc圆织机程序\8.c(288):MacroredefinitionofTWBR重复定义TWBRcallingfunctionwithoutprototypemaycauseerrors没有extern声明!Elianxi.o(103):multipledefine:'_main'main函数重复了,应该只能有一个main.[warning]declaringafunctionwithoutprototypemaycauseerrors函数原型没有声明。你调用的某个函数没有声明。Ambiguousoperatorsneedparentheses不明确的运算需要用括号括起Ambiguoussymbol``xxx``不明确的符号Argumentlistsyntaxerror参数表语法错误Arrayboundsmissing丢失数组界限符Arraysizetoolarge数组尺寸太大Badcharacterinparamenters参数中有不适当的字符Badfilenameformatinincludedirective包含命令中文件名格式不正确Badifdefdirectivesynatax编译预处理ifdef有语法错Badundefdirectivesyntax编译预处理undef有语法错Bitfieldtoolarge位字段太长Callofnon-function调用未定义的函数Calltofunctionwithnoprototype调用函数时没有函数的说明Cannotmodifyaconstobject不允许修改常量对象Caseoutsideofswitch漏掉了case语句CasesyntaxerrorCase语法错误Codehasnoeffect代码不可述不可能执行到Compoundstatementmissing{分程序漏掉{Conflictingtypemodifiers不明确的类型说明符Constantexpressionrequired要求常量表达式Constantoutofrangeincomparison在比较中常量超出范围Conversionmaylosesignificantdigits转换时会丢失意义的数字Conversionofnearpointernotallowed不允许转换近指针Couldnotfindfile``xxx``找不到XXX文件Declarationmissing;说明缺少;[小飞]一凡(490152151)12:03:21很多人用它,学起来资源多.圣心决(350310876)12:03:26Declarationsyntaxerror说明中出现语法错误DefaultoutsideofswitchDefault出现在switch语句之外Definedirectiveneedsanidentifier定义编译预处理需要标识符Divisionby
本文标题:iccavr编译时出现的错误解决办法
链接地址:https://www.777doc.com/doc-3414047 .html