2022年C语言编译中的常见错误 .pdf

上传人:C****o 文档编号:32036344 上传时间:2022-08-08 格式:PDF 页数:8 大小:66.58KB
返回 下载 相关 举报
2022年C语言编译中的常见错误 .pdf_第1页
第1页 / 共8页
2022年C语言编译中的常见错误 .pdf_第2页
第2页 / 共8页
点击查看更多>>
资源描述

《2022年C语言编译中的常见错误 .pdf》由会员分享,可在线阅读,更多相关《2022年C语言编译中的常见错误 .pdf(8页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、C 语言编译中的常见错误1 、 警告类错误? ,XXX?declare but never used变量 XXX 已定义但从未用过。? ,XXX?is assigned a value which is never used变量 XXX 已赋值但从未用过。? Code has no effect 程序中含有没有实际作用的代码。? Non-portable pointer conversion不适当的指针转换,可能是在应该使用指针的地方用了一个非0 的数值。? Possib le use of ,XXX?before definition表达式中使用了未赋值的变量? Possibly incor

2、rect assignment这样的赋值可能不正确? Redeclaration of ,main?一个程序文件中主函数main不止一个。? Suspicious pointer conversion可疑的指针转换。通常是使用了基本类型不匹配的指针。? Unreachable code程序含有不能执行到的代码。2 、错误或致命错误? Compound statement missing in function main程序结尾缺少括号 。? “ ” expected ; “ ( ” expected 等复合语句或数组初始化的结尾缺少“ ) ”;“ (” 。? Case outside of s

3、witch case不属于 Switch结构,多由于switch结构中的花括号不配对所致。? Case statement missing ,:?switch结构中的某个case 之后缺少冒号。? Constant expression required定义数组时指定的数组长度不是常量表达式。? Declaration syntax error 结构体或联合类型的定义后缺少分号。? Declaration was expected 缺少说明,通常是因为缺少分界符如逗号、分号、右圆括号等所引起的。? Default outside switch Default部分放到了switch结构之外,一般

4、是因为花括号不匹配而引起的。? do statement must have whiledo 语句中缺少相应的while部分。? Expression syntax 表达式语法错。如表达式中含有两个连续的运算符? Extra parameter in call ,fun?调用函数fun 时给出了多余的实参。名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 8 页 - - - - - - - - - ? Function should return a value函数应该返回

5、一个值,否则与定义时的说明类型不匹配。? Illegal use of pointer 指针被非法引用,一般是使用了非法的指针运算。? Invalid pointer addition指针相加非法。一个指针(地址)可以和一个整数相加,但两个指针不能相加。? Lvalue required赋值运算的左边是不能寻址的表达式。? Misplaced else程序遇到了没有配对的else ? No matching 表达式中的括号不配对。? Pointer required on left side of_在“ _”运算的左边只能允许一个指针而不能是一个一般的结构体变量或联合类型的变量。? State

6、ment missing;程序遇到了后面没有分号的语句。? Too few parameters in call 调用某个函数时实参数目不够。? Unable to open include file ,XXXXXXXXXXX?头文件找不到。? Unexpected 或: 或 在不希望的地方使用了 或: 。? Undefined symbol ,X?in function fun 函数 fun 中的变量X 没有定义。3 、连接中的常见错误主要错误类似于“ undefined symbol _print in modula xxx”(print 没有定义 ) ,通常是函数名书写错误。4 、运行中

7、的常见错误?Abnormal program termination程序异常终止。通常是由于内存使用不当所致。?Floating point error : Domain 或 Divide by 0运算结果不是一个数或被0 除?Null pointer assignment 对未初始化的指针赋值,程序有严重错误。?User break在运行程序时终止。5 、可跟踪调试的错误?XXX not an argument该标识符不是函数的参数?Array bounds missing 缺少数组界限符 ?Array size too large 数组规模太大?Bad file name format i

8、n include directive 在包含指令中的文件名格式不正确. 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 8 页 - - - - - - - - - ?Call of non-function 调用未经过定义的函数. ?Cannot modify a const object对常量不能进行修改. ?Character constant too long字符常量太大?Constant expression required数组定义的时候,数组大小要求是常数?

9、Compound statment missing 复合语句漏掉符号 ?Declaration syntax error宣告语法错误?Expression syntax 表达式语法错误?Extra parameter in call to sum调用函数时使用了过多的参数?Illegal use of floating point浮点数的不合法使用?Illegal pionter subtraction不合法的指针相减?Invalid pointer addition无效的指针相加?Out of memory内存不足?Statement missing ; 语句后面漏掉分号. 调试方法利用 R

10、un 菜单可以进行程序的跟踪调试(1)GO to Cursor () 选择该选项使程序执行到光标所在行首先将光标移到某行(一般为可执行),选择该功能项,则程序执行到该行的前一行暂停。此时程序处于跟踪调试状态,并有亮条显示在暂停处,此时可以查询变量或表达式的值。(2)Trace into () 执行一条语句或一行暂停此时程序处于跟踪调试状态,并有亮条显示在暂停处。该选项可跟踪到被调函数的内部。(3)Step over () 执行一条语句或一行暂停此时程序处于跟踪调试状态,并有亮条显示在暂停处。该选项将自定义函数当作一个语句执行,不跟踪到函程序的内部。(4)Debug菜单程序处于跟踪状态时,可使用

11、该菜单的选项。其主要是使用Evaluate 目的是查询或更新变量或表达式的值。名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 8 页 - - - - - - - - - 选择 Evaluate功能后,系统弹出一个对话框。该对话框包含三个选项区域: Evaluate域可以输入一个含有目前代码中(程序暂停区的作用域)正在使用的变量名、或含变量的表达式、或常量表达式。按回车键后,在Result域中显示变量或表达式的值。还可以用New value域进行调试。如果调试程序时发现Re

12、sult域显示的某变量或表达式的值不正确,并能估计出该变量或表达式的值,则可以将该值输入到New value域,继续执行程序,其目的是肯定错误发生处是否在当前位置之前。如果输入这个正确的值并将程序继续执行完毕而结果正确,说明在目前暂停处之前已经发生错误而之后无错误。(5)Break/Watch 用于设置断点和监视表达式。选择 Add Watch功能选项,系统将弹出一个菜单,在Add Watch框中输入变量名或表达式,按回车键后, 系统在屏幕底部开辟一个窗口并显示该变量或表达式的值。错误总汇:Ambiguous operators need parentheses:不明确的运算需要用括号括起Am

13、biguous symbol xxx :不明确的符号Argument list syntax error:参数表语法错误Array bounds missing :丢失数组界限符Array size toolarge :数组尺寸太大Bad character in paramenters :参数中有不适当的字符Bad file name format in include directive :包含命令中文件名格式不正确Bad ifdef directive synatax :编译预处理ifdef 有语法错Bad undef directive syntax :编译预处理undef有语法错Bi

14、t 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 error :Case 语法错误名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 8 页 - - -

15、- - - - - - Code has no effect :代码不可述不可能执行到Compound statement missing :分程序漏掉 Conflicting type modifiers :不明确的类型说明符Constant expression required :要求常量表达式Constant out of range in comparison :在比较中常量超出范围Conversion may lose significant digits :转换时会丢失意义的数字Conversion of near pointer not allowed :不允许转换近指针Cou

16、ld not find file xxx :找不到 XXX 文件Declaration missing ; :说明缺少 ; Declaration syntax error :说明中出现语法错误Default outside of switch :Default 出现在 switch语句之外Define directive needs an identifier :定义编译预处理需要标识符Division by zero :用零作除数Do statement must have while :Do-while语句中缺少while部分Enum syntax error :枚举类型语法错误Enum

17、eration constant syntax error :枚举常数语法错误Error directive :xxx :错误的编译预处理命令Error writing output file :写输出文件错误Expression syntax error :表达式语法错误Extra parameter in call :调用时出现多余错误File name too long :文件名太长Function call missing ) :函数调用缺少右括号Fuction definition out of place :函数定义位置错误Fuction should return a value

18、 :函数必需返回一个值Goto statement missing label :Goto语句没有标号Hexadecimal or octal constant too large :16进制或 8 进制常数太大Illegal character x :非法字符x Illegal initialization :非法的初始化Illegal octal digit :非法的 8 进制数字Illegal pointer subtraction :非法的指针相减名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - -

19、- - - - 第 5 页,共 8 页 - - - - - - - - - Illegal structure operation :非法的结构体操作Illegal use of floating point :非法的浮点运算Illegal use of pointer :指针使用非法Improper use of a typedefsymbol :类型定义符号使用不恰当In-line assembly not allowed :不允许使用行间汇编Incompatible storage class :存储类别不相容Incompatible type conversion :不相容的类型转换I

20、ncorrect number format :错误的数据格式Incorrect use of default Default使用不当Invalid indirection 无效的间接运算Invalid pointer addition 指针相加无效Irreducible expression tree 无法执行的表达式运算Lvalue required 需要逻辑值0 或非 0 值Macro argument syntax error 宏参数语法错误Macro expansion too long 宏的扩展以后太长Mismatched number of parameters in defin

21、ition 定义中参数个数不匹配Misplaced break 此处不应出现break语句Misplaced continue 此处不应出现continue语句Misplaced decimal point 此处不应出现小数点Misplaced elif directive 不应编译预处理elif Misplaced else 此处不应出现else Misplaced else directive 此处不应出现编译预处理else Misplaced endif directive 此处不应出现编译预处理endif Must be addressable 必须是可以编址的Must take ad

22、dress of memory location 必须存储定位的地址No declaration for function xxx 没有函数xxx 的说明No stack 缺少堆栈No type information 没有类型信息名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 6 页,共 8 页 - - - - - - - - - Non-portable pointer assignment 不可移动的指针(地址常数)赋值Non-portable pointer comparis

23、on 不可移动的指针(地址常数)比较Non-portable pointer conversion 不可移动的指针(地址常数)转换Not a valid expression format type 不合法的表达式格式Not an allowed type 不允许使用的类型Numeric constant too large 数值常太大Out of memory 内存不够用Parameter xxx is never used 能数 xxx没有用到Pointer required on left side of - 符号 - 的左边必须是指针Possible use of xxx before

24、 definition 在定义之前就使用了xxx (警告)Possibly incorrect assignment 赋值可能不正确Redeclaration of xxx 重复定义了xxx Redefinition of xxx is not identical xx的两次定义不一致Register allocation failure 寄存器定址失败Repeat count needs an lvalue 重复计数需要逻辑值Size of structure or array not known 结构体或数给大小不确定Statement missing ; 语句后缺少 ; Structur

25、e or union syntax error X构体或联合体语法错误Structure size too large 结构体尺寸太大Sub scripting missing 下标缺少右方括号Superfluous & with function or array 函数或数组中有多余的& Suspicious pointer conversion 可疑的指针转换Symbol limit exceeded 符号超限Too few parameters in call 函数调用时的实参少于函数的参数不Too many default cases Default太多 (switch语句中一个 )

26、Too many error or warning messages 错误或警告信息太多Too many type in declaration 说明中类型太多Too much auto memory in function 函数用到的局部存储太多Too much global data defined in file 文件中全局数据太多Two consecutive dots 两个连续的句点名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 8 页 - - - - - -

27、- - - Type mismatch in parameter xxx 数 xxx类型不匹配Type mismatch in redeclaration of xxx xx重定义的类型不匹配Unable to create output file xxx 无法建立输出文件xxx Unable to open include file xxx 无法打开被包含的文件xxx Unable to open input file xxx 无法打开输入文件xxx Undefined label xxx 没有定义的标号xxx Undefined structure xxx 没有定义的结构xxx Undef

28、ined symbol xxx 没有定义的符号xxx Unexpected end of file in comment started on line xxx 从 xxx行开始的注解尚未结束文件不能结束Unexpected end of file in conditional started on line xxx 从 xxx 开始的条件语句尚未结束文件不能结束Unknown assemble instruction 未知的汇编结构Unknown option 未知的操作Unknown preprocessor directive: xxx 不认识的预处理命令xxx Unreachable

29、code 无路可达的代码Unterminated string or character constant 字符串缺少引号User break 用户强行中断了程序Void functions may not return a value Void类型的函数不应有返回值Wrong number of arguments 调用函数的参数数目错xxx not an argument xxx不是参数xxx not part of structure xxx不是结构体的一部分xxx statement missing ( xx语句缺少左括号xxx statement missing ) xxx语句缺少右括号xxx statement missing ; xxx缺少分号xxx declared but never used 说明了 xxx 但没有使用xxx is assigned a value which is never used 给 xxx 赋了值但未用过Zero length structure 结构体的长度为零名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 8 页 - - - - - - - - -

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁