c语言错误大全

合集下载

C语言错误大全

C语言错误大全

1、意思是:在 xxx 之前应输入表达式。

2、下面为C语言的错误大全及中文解释:1: Ambiguous operators need parentheses —不明确的运算需要用括号括起2: Ambiguous symbol xxx —不明确的符号3: Argument list syntax error —参数表语法错误4: Array bounds missing —丢失数组界限符5: Array size toolarge —数组尺寸太大6: Bad character in paramenters —参数中有不适当的字符7: Bad file name format in include directive —包含命令中文件名格式不正确8: Bad ifdef directive synatax —编译预处理ifdef有语法错9: Bad undef directive syntax —编译预处理undef有语法错10: Bit field too large —位字段太长11: Call of non-function —调用未定义的函数12: Call to function with no prototype —调用函数时没有函数的说明13: Cannot modify a const object —不允许修改常量对象14: Case outside of switch —漏掉了case 语句15: Case syntax error — Case 语法错误16: Code has no effect —代码不可能执行到17: Compound statement missing{ —分程序漏掉"{"18: Conflicting type modifiers —不明确的类型说明符19: Constant expression required —要求常量表达式20: Constant out of range in comparison —在比较中常量超出范围21: Conversion may lose significant digits —转换时会丢失意义的数字22: Conversion of near pointer not allowed —不允许转换近指针23: Could not find file xxx —找不到XXX文件24: Declaration missing ; —说明缺少";"25: Declaration syntax error —说明中出现语法错误26: Default outside of switch — Default 出现在switch语句之外27: Define directive needs an identifier —定义编译预处理需要标识符28: Division by zero —用零作除数29: Do statement must have while — Do-while语句中缺少while部分30: Enum syntax error —枚举类型语法错误31: Enumeration constant syntax error —枚举常数语法错误32: Error directive :xxx —错误的编译预处理命令33: Error writing output file —写输出文件错误34: Expression syntax error —表达式语法错误35: Extra parameter in call —调用时出现多余错误36: File name too long —文件名太长37: Function call missing ) —函数调用缺少右括号38: Fuction definition out of place —函数定义位置错误39: Fuction should return a value —函数必需返回一个值40: Goto statement missing label —Goto语句没有标号41: Hexadecimal or octal constant too large —16进制或8进制常数太大42: Illegal character x —非法字符x43: Illegal initialization —非法的初始化44: Illegal octal digit —非法的8进制数字 A45: Illegal pointer subtraction —非法的指针相减46: Illegal structure operation —非法的结构体操作47: Illegal use of floating point —非法的浮点运算48: Illegal use of pointer —指针使用非法49: Improper use of a typedefsymbol —类型定义符号使用不恰当50: In-line assembly not allowed —不允许使用行间汇编51: Incompatible storage class —存储类别不相容52: Incompatible type conversion —不相容的类型转换53: Incorrect number format —错误的数据格式54: Incorrect use of default — Default使用不当55: Invalid indirection —无效的间接运算56: Invalid pointer addition —指针相加无效57: Irreducible expression tree —无法执行的表达式运算58: Lvalue required —需要逻辑值0或非0值59: Macro argument syntax error —宏参数语法错误60: Macro expansion too long —宏的扩展以后太长61: Mismatched number of parameters in definition —定义中参数个数不匹配62: Misplaced break —此处不应出现break语句63: Misplaced continue —此处不应出现continue语句64: Misplaced decimal point —此处不应出现小数点65: Misplaced elif directive —不应编译预处理elif66: Misplaced else —此处不应出现else67: Misplaced else directive —此处不应出现编译预处理else68: Misplaced endif directive —此处不应出现编译预处理endif69: Must be addressable —必须是可以编址的70: Must take address of memory location —必须存储定位的地址71: No declaration for function xxx —没有函数xxx的说明72: No stack —缺少堆栈73: No type information —没有类型信息74: Non-portable pointer assignment —不可移动的指针(地址常数)赋值75: Non-portable pointer comparison —不可移动的指针(地址常数)比较76: Non-portable pointer conversion —不可移动的指针(地址常数)转换77: Not a valid expression format type —不合法的表达式格式78: Not an allowed type —不允许使用的类型79: Numeric constant too large —数值常太大80: Out of memory —内存不够用81: Parameter xxx is never used —能数xxx没有用到82: Pointer required on left side of -> —符号->的左边必须是指针83: Possible use of xxx before definition —在定义之前就使用了xxx(警告)84: Possibly incorrect assignment —赋值可能不正确85: Redeclaration of xxx —重复定义了xxx86: Redefinition of xxx is not identical — xxx的两次定义不一致87: Register allocation failure —寄存器定址失败88: Repeat count needs an lvalue —重复计数需要逻辑值89: Size of structure or array not known —结构体或数给大小不确定90: Statement missing ; —语句后缺少";"91: Structure or union syntax error —结构体或联合体语法错误92: Structure size too large —结构体尺寸太大93: Sub scripting missing ] —下标缺少右方括号94: Superfluous & with function or array —函数或数组中有多余的"&" 95: Suspicious pointer conversion —可疑的指针转换96: Symbol limit exceeded —符号超限97: Too few parameters in call —函数调用时的实参少于函数的参数不98: Too many default cases — Default太多(switch语句中一个)99: Too many error or warning messages —错误或警告信息太多100: Too many type in declaration —说明中类型太多101: Too much auto memory in function —函数用到的局部存储太多102: Too much global data defined in file —文件中全局数据太多103: Two consecutive dots —两个连续的句点104: Type mismatch in parameter xxx —参数xxx类型不匹配105: Type mismatch in redeclaration of xxx — xxx重定义的类型不匹配106: Unable to create output file xxx —无法建立输出文件xxx107: Unable to open include file xxx —无法打开被包含的文件xxx108: Unable to open input file xxx —无法打开输入文件xxx109: Undefined label xxx —没有定义的标号xxx110: Undefined structure xxx —没有定义的结构xxx111: Undefined symbol xxx —没有定义的符号xxx112: Unexpected end of file in comment started on line xxx —从xxx行开始的注解尚未结束文件不能结束113: Unexpected end of file in conditional started on line xxx —从xxx 开始的条件语句尚未结束文件不能结束114: Unknown assemble instruction —未知的汇编结构115: Unknown option —未知的操作116: Unknown preprocessor directive: xxx —不认识的预处理命令xxx117: Unreachable code —无路可达的代码118: Unterminated string or character constant —字符串缺少引号119: User break —用户强行中断了程序120: Void functions may not return a value — Void类型的函数不应有返回值121: Wrong number of arguments —调用函数的参数数目错122: xxx not an argument — xxx不是参数123: xxx not part of structure — xxx不是结构体的一部分124: xxx statement missing ( — xxx语句缺少左括号125: xxx statement missing ) — xxx语句缺少右括号126: xxx statement missing ; — xxx缺少分号127: xxx declared but never used —说明了xxx但没有使用128: xxx is assigned a value which is never used —给xxx赋了值但未用过。

C语言常见错误解析

C语言常见错误解析

C语言常见错误解析:1)编译错误和运行错误:1,选择编辑的文件类型不是C语言。

如:文件扩展名不是.cpp, 而是.asp等。

重做。

错误提示:解析:编辑区上方的文件名的扩展名为:.asp是网站文件, 不是正常的.cpp文件。

当然编译菜单为灰色,无法编译。

2,做完一个程序后,没有关闭工作区,继续做下一个程序,编译系统无法确定编译多个主函数中的哪一个。

关闭工作区后,重做(这时,可使用复制粘贴方法)。

错误提示:解析:左边看出,有两个main()函数,原来的是t.cpp(工程名也是t), 现在的是li.cpp,可以编译,但不能运行。

每次运行的都是原来的程序t.exe.同时,可以看到,编译的主文件名li.cpp,与构件的文件名t.exe不相同。

3,编译系统本身故障。

编译菜单呈灰色,无法编译,按下ctl+alt+del三个键,在任务工作区,强制关闭VC,重新启动。

错误提示:略改正方法:按照正确的流程创建C语言源程序文件。

2)宏定义错误:引发语法错误错误原因:1,位置错误,宏定义错误放入函数内部;应在所有函数的前面。

错误提示:解析:遇到define,标志符出现错误,没有定义。

与函数体的语句定义格式不符。

2,缺少宏定义标志符“#”;错误提示:define pi 3.1415927解析:引起三个错误。

3,宏定义后面多加了分号“;”,误认为是语句;错误提示:语句,定义#define pi 3.1415927; 使用宏定义area=2*pi*banjing*banjing;解析:非法间接使用。

4,宏定义中库函数名错误:如sdtil.h, maths.h等错误提示:解析:不能打开stido.h文件,单引号中标志符’stido.h’错误。

5,宏定义中库函数引用标志错误:应使用一对尖括号或一对双引号<>或”“,不用函数标志圆括号( )错误提示:解析:#include中单引号中左圆括号‘(’使用错误,两函数没有定义。

C语言新手编程时常犯的10个错误及解决方式

C语言新手编程时常犯的10个错误及解决方式

C语言的最大特点是:功能强、使用方便灵活。

C编译的程序对语法检查并不象其它高级语言那么严格,这就给编程人员留下“灵活的余地”,但还是由于这个灵活给程序的调试带来了许多不便,尤其对初学C语言的人来说,经常会出一些连自己都不知道错在哪里的错误。

看着有错的程序,不知该如何改起,小编通过对C的学习,积累了一些C编程时常犯的错误,写给各位学员以供参考。

1、将字符常量与字符串常量混淆。

char c;c="a";在这里就混淆了字符常量与字符串常量,字符常量是由一对单引号括起来的单个字符,字符串常量是一对双引号括起来的字符序列。

C规定以“”作字符串结束标志,它是由系统自动加上的,所以字符串“a”实际上包含两个字符:‘a'和‘',而把它赋给一个字符变量是不行的。

2、输入数据时,企图规定精度。

scanf("%7.2f",&a);这样做是不合法的,输入数据时不能规定精度。

3、输入字符的格式与要求不一致。

在用“%c”格式输入字符时,“空格字符”和“转义字符”都作为有效字符输入。

scanf("%c%c%c",&c1,&c2,&c3);如输入a b c字符“a”送给c1,字符“”送给c2,字符“b”送给c3,因为%c只要求读入一个字符,后面不需要用空格作为两个字符的间隔。

4、输入输出的数据类型与所用格式说明符不一致。

例如,a已定义为整型,b定义为实型a=3;b=4.5;printf("%f%d ",a,b);编译时不给出出错信息,但运行结果将与原意不符。

这种错误尤其需要注意。

5.switch语句中漏写break语句。

例如:根据考试成绩的等级打印出百分制数段。

switch(grade){case 'A':printf("85~100 ");case 'B':printf("70~84 ");case 'C':printf("60~69 ");case 'D':printf("<60 ");default:printf("error ");}由于漏写了break语句,case只起标号的作用,而不起判断作用。

C语言报错整理大全

C语言报错整理大全

C语言错误代码及错误信息错误释义error 1: Out of memory 内存溢出error 2: Identifier expected 缺标识符error 3: Unknown identifier 未定义的标识符error 4: Duplicate identifier 重复定义的标识符error 5: Syntax error 语法错误error 6: Error in real constant 实型常量错误error 7: Error in integer constant 整型常量错误error 8: String constant exceeds line 字符串常量超过一行error 10: Unexpected end of file 文件非正常结束error 11: Line too long 行太长error 12: Type identifier expected 未定义的类型标识符error 13: Too many open files 打开文件太多error 14: Invalid file name 无效的文件名error 15: File not found 文件未找到error 16: Disk full 磁盘满error 17: Invalid compiler directive 无效的编译命令error 18: Too many files 文件太多error 19: Undefined type in pointer def 指针定义中未定义类型error 20: Variable identifier expected 缺变量标识符error 21: Error in type 类型错误error 22: Structure too large 结构类型太长error 23: Set base type out of range 集合基类型越界error 24: File components may not be files or objectsfile分量不能是文件或对象error 25: Invalid string length 无效的字符串长度error 26: Type mismatch 类型不匹配error 27:error 27:Invalid subrange base type 无效的子界基类型error 28:Lower bound greater than upper bound 下界超过上界error 29:Ordinal type expected 缺有序类型error 30:Integer constant expected 缺整型常量error 31:Constant expected 缺常量error 32:Integer or real constant expected 缺整型或实型常量error 33:Pointer Type identifier expected 缺指针类型标识符error 34:Invalid function result type 无效的函数结果类型error 35:Label identifier expected 缺标号标识符error 36:BEGIN expected 缺BEGINerror 37:END expected 缺ENDerror 38:Integer expression expected 缺整型表达式error 39:Ordinal expression expected 缺有序类型表达式error 40:Boolean expression expected 缺布尔表达式error 41:Operand types do not match 操作数类型不匹配error 42:Error in expression 表达式错误error 43:Illegal assignment 非法赋值error 44:Field identifier expected 缺域标识符error 45:Object file too large 目标文件太大error 46:Undefined external 未定义的外部过程与函数error 47:Invalid object file record 无效的OBJ文件格式error 48:Code segment too large 代码段太长error 49:Data segment too large 数据段太长error 50:DO expected 缺DOerror 51:Invalid PUBLIC definition 无效的PUBLIC定义error 52:Invalid EXTRN definition 无效的EXTRN定义error 53: Too many EXTRN definitions 太多的EXTRN定义error 54:OF expected 缺OFerror 55:INTERFACE expected 缺INTERFACEerror 56:Invalid relocatable reference 无效的可重定位引用error 57:THEN expected 缺THENerror 58:TO or DOWNTO expected 缺TO或DOWNTO error 59:Undefined forward 提前引用未经定义的说明error 61:Invalid typecast 无效的类型转换error 62:Division by zero 被零除error 63:Invalid file type 无效的文件类型error 64:Cannot read or write variables of this type 不能读写此类型变量error 65:Pointer variable expected 缺指针类型变量error 66:String variable expected 缺字符串变量error 67:String expression expected 缺字符串表达式error 68:Circular unit reference 单元UNIT部件循环引用error 69:Unit name mismatch 单元名不匹配error 70:Unit version mismatch 单元版本不匹配error 71:Internal stack overflow 内部堆栈溢出error 72:Unit file format error 单元文件格式错误error 73:IMPLEMENTATION expected 缺IMPLEMENTATIONerror 74:Constant and case types do not match 常量和CASE类型不匹配error 75:Record or object variable expected 缺记录或对象变量error 76:Constant out of range 常量越界error 77:File variable expected 缺文件变量error 78:Pointer expression expected 缺指针表达式error 79:Integer or real expression expected 缺整型或实型表达式error 80:Label not within current block 标号不在当前块内error 81:Label already defined 标号已定义error 82:Undefined label in preceding statement part 在前面未定义标号error 83:Invalid @ argument 无效的@参数error 84:UNIT expected 缺UNITerror 85: ";" expected 缺“;”error 86:":" expected 缺“:”error 87:"," expected 缺“,”error 88:"(" expected 缺“(”error 89:")" expected 缺“)”error 90:"=" expected 缺“=”error 91:":=" expected 缺“:=”error 92:"[" or "(." Expected 缺“[”或“(.”error 93: "]" or ".)" expected 缺“]”或“.)”error 94:"." expected 缺“.”error 95: ".." expected 缺“..”error 96:Too many variables 变量太多error 97:Invalid FOR control variable 无效的FOR循环控制变量error 98:Integer variable expected 缺整型变量error 99:Files and procedure types are not allowed here 该处不允许文件和过程类型error 100:String length mismatch 字符串长度不匹配error 101:Invalid ordering of fields 无效域顺序error 102:String constant expected 缺字符串常量error 103:Integer or real variable expected 缺整型或实型变量error 104:Ordinal variable expected 缺有序类型变量error 105:INLINE error INLINE错误error 106:Character expression expected 缺字符表达式error 107:Too many relocation items 重定位项太多error 108:Overflow in arithmetic operation 算术运算溢出error 112:CASE constant out of range CASE常量越界error 113:Error in statement 表达式错误error 114:Cannot call an interrupt procedure 不能调用中断过程error 116:Must be in 8087 mode to compile this 必须在8087模式编译error 117:Target address not found 找不到目标地址error 118:Include files are not allowed here 该处不允许INCLUDE文件error 119:No inherited methods are accessible here 该处继承方法不可访问error 121:Invalid qualifier 无效的限定符error 122:Invalid variable reference 无效的变量引用error 123:Too many symbols 符号太多error 124:Statement part too large 语句体太长error 126:Files must be var parameters 文件必须是变量形参error 127:Too many conditional symbols 条件符号太多error 128:Misplaced conditional directive 条件指令错位error 129:ENDIF directive missing 缺ENDIF指令error 130:Error in initial conditional defines 初始条件定义错误error 131:Header does not match previous definition 和前面定义的过程或函数不匹配error 133:Cannot evaluate this expression 不能计算该表达式error 134:Expression incorrectly terminated 表达式错误结束error 135:Invalid format specifier 无效格式说明符error 136:Invalid indirect reference 无效的间接引用error 137:Structured variables are not allowed here 该处不允许结构变量error 138:Cannot evaluate without System unit 没有System单元不能计算error 139:Cannot access this symbol 不能存取符号error 140:Invalid floating point operation 无效的符号运算error 141:Cannot compile overlays to memory 不能编译覆盖模块至内存error 142:Pointer or procedural variable expected 缺指针或过程变量error 143:Invalid procedure or function reference 无效的过程或函数调用error 144:Cannot overlay this unit 不能覆盖该单元error 146:File access denied 不允许文件访问error 147:Object type expected 缺对象类型error 148:Local object types are not allowed 不允许局部对象类型error 149:VIRTUAL expected 缺VIRTUALerror 150: Method identifier expected 缺方法标识符error 151:Virtual constructors are not allowed 不允许虚构造函数error 152:Constructor identifier expected 缺构造函数标识符error 153:Destructor identifier expected 缺析构函数标识符error 154:Fail only allowed within constructors 只能在构造函数内使用Fail标准过程error 155:Invalid combination of opcode and operands 操作数与操作符无效组合error 156:Memory reference expected 缺内存引用指针error 157:Cannot add or subtract relocatable symbols 不能加减可重定位符号error 158:Invalid register combination 无效寄存器组合error 159:286/287 instructions are not enabled 未激活286/287指令error 160:Invalid symbol reference 无效符号指针error 161:Code generation error 代码生成错误error 162:ASM expected 缺ASMerror 166:Procedure or function identifier expected 缺过程或函数标识符error 167:Cannot export this symbol 不能输出该符号error 168:Duplicate export name 外部文件名重复error 169:Executable file header toerror 170:Too many segments 段太多fatal error C1004: unexpected end of file found 未找到文件末尾(可能是括号匹配问题)fatal error C1021: invalid preprocessor command '1nclude' 无效的编译预处理命令'1nclude' fatal error C1083: Cannot open include file: 'stdi.h': No such file or directory 不能打开头文件'stdi.h',文件或文件夹不存在 error C2101: '&' on constant 不能计算常量的地址error C2059: syntax error : 'while' 在'while'附近,存在语法错误error C2061: syntax error : identifier 'x' 标识符x的附近,存在语法错误 error C2065: 'i' : undeclared identifier 变量i未定义error C2078: too many initializers 数组/结构等变量初始化时的数据太多error C2087: '<Unknown>' : missing subscript 丢失数组下标error C2106: '=' : left operand must be l-value '='的左侧应当是左值,即不能是常量 error C2115: '=' : incompatible types '='两侧的类型不兼容error C2133: 'a' : unknown size a(可能是数组名)的大小不确定。

C语言错误大全

C语言错误大全

C語言錯誤大全1. Ambiguous operators need parentheses —不明確的運算需要用括號括起2. Ambiguous symbol 'xxx' —不明確的符號3. Argument list syntax error —參數表語法錯誤4. Array bounds missing —丟失數組界限符5. Array size toolarge —數組尺寸太大6. Bad character in paramenters —參數中有不適當的字符7. Bad file name format in include directive —包含命令中文件名格式不正確8. Bad ifdef directive synatax —編譯預處理ifdef有語法錯9. Bad undef directive syntax —編譯預處理undef有語法錯10. Bit field too large —位字段太長11. Call of non-function —調用未定義的函數12. Call to function with no prototype —調用函數時沒有函數的說明13. Cannot modify a const object —不允許修改常量對象14. Case outside of switch —漏掉了case 語句15. Case syntax error — Case 語法錯誤16. Code has no effect —代碼不可能執行到17. Compound statement missing{ —分程序漏掉"{"18. Conflicting type modifiers —不明確的類型說明符19. Constant expression required —要求常量表達式20. Constant out of range in comparison —在比較中常量超出範圍21. Conversion may lose significant digits —轉換時會丟失意義的數字22. Conversion of near pointer not allowed —不允許轉換近指針23. Could not find file 'xxx' —找不到XXX文件24. Declaration missing ; —說明缺少";"25. Declaration syntax error —說明中出現語法錯誤26. Default outside of switch — Default 出現在switch語句之外27. Define directive needs an identifier —定義編譯預處理需要標識符28. Division by zero —用零作除數29. Do statement must have while — Do-while語句中缺少while部分30. Enum syntax error —枚舉類型語法錯誤31. Enumeration constant syntax error —枚舉常數語法錯誤32. Error directive :xxx —錯誤的編譯預處理命令33. Error writing output file —寫輸出文件錯誤34. Expression syntax error —表達式語法錯誤35. Extra parameter in call —調用時出現多餘錯誤36. File name too long —文件名太長37. Function call missing ) —函數調用缺少右括號38. Fuction definition out of place —函數定義位置錯誤39. Fuction should return a value —函數必需返回一個值40. Goto statement missing label — Goto語句沒有標號41. Hexadecimal or octal constant too large — 16進制或8進制常數太大42. Illegal character 'x' —非法字符x43. Illegal initialization —非法的初始化44. Illegal octal digit —非法的8進制數字45. Illegal pointer subtraction —非法的指針相減46. Illegal structure operation —非法的結構體操作47. Illegal use of floating point —非法的浮點運算48. Illegal use of pointer —指針使用非法49. Improper use of a typedefsymbol —類型定義符號使用不恰當50. In-line assembly not allowed —不允許使用行間匯編51. Incompatible storage class —存儲類別不相容52. Incompatible type conversion —不相容的類型轉換53. Incorrect number format —錯誤的數據格式54. Incorrect use of default — Default使用不當55. Invalid indirection —無效的間接運算56. Invalid pointer addition —指針相加無效57. Irreducible expression tree —無法執行的表達式運算58. Lvalue required —需要邏輯值0或非0值59. Macro argument syntax error —宏參數語法錯誤60. Macro expansion too long —宏的擴展以後太長61. Mismatched number of parameters in definition —定義中參數個數不匹配62. Misplaced break —此處不應出現break語句63. Misplaced continue —此處不應出現continue語句64. Misplaced decimal point —此處不應出現小數點65. Misplaced elif directive —不應編譯預處理elif66. Misplaced else —此處不應出現else67. Misplaced else directive —此處不應出現編譯預處理else68. Misplaced endif directive —此處不應出現編譯預處理endif69. Must be addressable —必須是可以編址的70. Must take address of memory location —必須存儲定位的地址71. No declaration for function 'xxx' —沒有函數xxx的說明72. No stack —缺少堆棧73. No type information —沒有類型信息74. Non-portable pointer assignment —不可移動的指針(地址常數)賦值75. Non-portable pointer comparison —不可移動的指針(地址常數)比較76. Non-portable pointer conversion —不可移動的指針(地址常數)轉換77. Not a valid expression format type —不合法的表達式格式78. Not an allowed type —不允許使用的類型79. Numeric constant too large —數值常太大80. Out of memory —內存不夠用81. Parameter 'xxx' is never used —能數xxx沒有用到82. Pointer required on left side of -> —符號->的左邊必須是指針83. Possible use of 'xxx' before definition —在定義之前就使用了xxx(警告)84. Possibly incorrect assignment —賦值可能不正確85. Redeclaration of 'xxx' —重複定義了xxx86. Redefinition of 'xxx' is not identical — xxx的兩次定義不一致87. Register allocation failure —寄存器定址失敗88. Repeat count needs an lvalue —重複計數需要邏輯值89. Size of structure or array not known —結構體或數給大小不確定90. Statement missing ; —語句後缺少";"91. Structure or union syntax error —結構體或聯合體語法錯誤92. Structure size too large —結構體尺寸太大93. Sub scripting missing ] —下標缺少右方括號94. Superfluous & with function or array —函數或數組中有多餘的"&"95. Suspicious pointer conversion —可疑的指針轉換96. Symbol limit exceeded —符號超限97. Too few parameters in call —函數調用時的實參少於函數的參數不98. Too many default cases — Default太多(switch語句中一個)99. Too many error or warning messages —錯誤或警告信息太多100. Too many type in declaration —說明中類型太多101. Too much auto memory in function —函數用到的局部存儲太多102. Too much global data defined in file —文件中全局數據太多103. Two consecutive dots —兩個連續的句點104. Type mismatch in parameter xxx —參數xxx類型不匹配105. Type mismatch in redeclaration of 'xxx' — xxx重定義的類型不匹配106. Unable to create output file 'xxx' —無法建立輸出文件xxx107. Unable to open include file 'xxx' —無法打開被包含的文件xxx108. Unable to open input file 'xxx' —無法打開輸入文件xxx109. Undefined label 'xxx' —沒有定義的標號xxx110. Undefined structure 'xxx' —沒有定義的結構xxx111. Undefined symbol 'xxx' —沒有定義的符號xxx112. Unexpected end of file in comment started on line xxx —從xxx行開始的注解尚未結束文件不能結束113. Unexpected end of file in conditional started on line xxx —從xxx 開始的條件語句尚未結束文件不能結束114. Unknown assemble instruction —未知的匯編結構115. Unknown option —未知的操作116. Unknown preprocessor directive: 'xxx' —不認識的預處理命令xxx117. Unreachable code —無路可達的代碼118. Unterminated string or character constant —字符串缺少引號119. User break —用戶強行中斷了程序120. Void functions may not return a value — Void類型的函數不應有返回值121. Wrong number of arguments —調用函數的參數數目錯122. 'xxx' not an argument — xxx不是參數123. 'xxx' not part of structure — xxx不是結構體的一部分124. xxx statement missing ( — xxx語句缺少左括號125. xxx statement missing ) — xxx語句缺少右括號126. xxx statement missing ; — xxx缺少分號127. xxx' declared but never used —說明了xxx但沒有使用128. xxx' is assigned a value which is never used —給xxx賦了值但未用過C語言編譯錯誤信息錦集說明:Turbo C 的源程序錯誤分為三種類型:致命錯誤、一般錯誤和警告。

c语言错误大全

c语言错误大全

1、'bad suffix on number'是数字的下标错误。

2、下面为C语言的错误大全及中文解释:1: Ambiguous operators need parentheses —不明确的运算需要用括号括起2: Ambiguous symbol xxx —不明确的符号3: Argument list syntax error —参数表语法错误4: Array bounds missing —丢失数组界限符5: Array size toolarge —数组尺寸太大6: Bad character in paramenters —参数中有不适当的字符7: Bad file name format in include directive —包含命令中文件名格式不正确8: Bad ifdef directive synatax —编译预处理ifdef有语法错9: Bad undef directive syntax —编译预处理undef有语法错10: Bit field too large —位字段太长11: Call of non-function —调用未定义的函数12: Call to function with no prototype —调用函数时没有函数的说明13: Cannot modify a const object —不允许修改常量对象14: Case outside of switch —漏掉了case 语句15: Case syntax error —Case 语法错误16: Code has no effect —代码不可能执行到17: Compound statement missing{ —分程序漏掉"{"18: Conflicting type modifiers —不明确的类型说明符19: Constant expression required —要求常量表达式20: Constant out of range in comparison —在比较中常量超出范围21: Conversion may lose significant digits —转换时会丢失意义的数字22: Conversion of near pointer not allowed —不允许转换近指针23: Could not find file xxx —找不到XXX文件24: Declaration missing ; —说明缺少";"25: Declaration syntax error —说明中出现语法错误26: Default outside of switch —Default 出现在switch语句之外27: Define directive needs an identifier —定义编译预处理需要标识符28: Division by zero —用零作除数29: Do statement must have while —Do-while语句中缺少while部分30: Enum syntax error —枚举类型语法错误31: Enumeration constant syntax error —枚举常数语法错误32: Error directive :xxx —错误的编译预处理命令33: Error writing output file —写输出文件错误34: Expression syntax error —表达式语法错误35: Extra parameter in call —调用时出现多余错误36: File name too long —文件名太长37: Function call missing ) —函数调用缺少右括号38: Fuction definition out of place —函数定义位置错误39: Fuction should return a value —函数必需返回一个值40: Goto statement missing label —Goto语句没有标号41: Hexadecimal or octal constant too large —16进制或8进制常数太大42: Illegal character x —非法字符x43: Illegal initialization —非法的初始化44: Illegal octal digit —非法的8进制数字A45: Illegal pointer subtraction —非法的指针相减46: Illegal structure operation —非法的结构体操作47: Illegal use of floating point —非法的浮点运算48: Illegal use of pointer —指针使用非法49: Improper use of a typedefsymbol —类型定义符号使用不恰当50: In-line assembly not allowed —不允许使用行间汇编51: Incompatible storage class —存储类别不相容52: Incompatible type conversion —不相容的类型转换53: Incorrect number format —错误的数据格式54: Incorrect use of default —Default使用不当55: Invalid indirection —无效的间接运算56: Invalid pointer addition —指针相加无效57: Irreducible expression tree —无法执行的表达式运算58: Lvalue required —需要逻辑值0或非0值59: Macro argument syntax error —宏参数语法错误60: Macro expansion too long —宏的扩展以后太长61: Mismatched number of parameters in definition —定义中参数个数不匹配62: Misplaced break —此处不应出现break语句63: Misplaced continue —此处不应出现continue语句64: Misplaced decimal point —此处不应出现小数点65: Misplaced elif directive —不应编译预处理elif66: Misplaced else —此处不应出现else67: Misplaced else directive —此处不应出现编译预处理else68: Misplaced endif directive —此处不应出现编译预处理endif69: Must be addressable —必须是可以编址的70: Must take address of memory location —必须存储定位的地址71: No declaration for function xxx —没有函数xxx的说明72: No stack —缺少堆栈73: No type information —没有类型信息74: Non-portable pointer assignment —不可移动的指针(地址常数)赋值75: Non-portable pointer comparison —不可移动的指针(地址常数)比较76: Non-portable pointer conversion —不可移动的指针(地址常数)转换77: Not a valid expression format type —不合法的表达式格式78: Not an allowed type —不允许使用的类型79: Numeric constant too large —数值常太大80: Out of memory —内存不够用81: Parameter xxx is never used —能数xxx没有用到82: Pointer required on left side of -> —符号->的左边必须是指针83: Possible use of xxx before definition —在定义之前就使用了xxx(警告)84: Possibly incorrect assignment —赋值可能不正确85: Redeclaration of xxx —重复定义了xxx86: Redefinition of xxx is not identical —xxx的两次定义不一致87: Register allocation failure —寄存器定址失败88: Repeat count needs an lvalue —重复计数需要逻辑值89: Size of structure or array not known —结构体或数给大小不确定90: Statement missing ; —语句后缺少";"91: Structure or union syntax error —结构体或联合体语法错误92: Structure size too large —结构体尺寸太大93: Sub scripting missing ] —下标缺少右方括号94: Superfluous & with function or array —函数或数组中有多余的"&" 95: Suspicious pointer conversion —可疑的指针转换96: Symbol limit exceeded —符号超限97: Too few parameters in call —函数调用时的实参少于函数的参数不98: Too many default cases —Default太多(switch语句中一个)99: Too many error or warning messages —错误或警告信息太多100: Too many type in declaration —说明中类型太多101: Too much auto memory in function —函数用到的局部存储太多102: Too much global data defined in file —文件中全局数据太多103: Two consecutive dots —两个连续的句点104: Type mismatch in parameter xxx —参数xxx类型不匹配105: Type mismatch in redeclaration of xxx —xxx重定义的类型不匹配106: Unable to create output file xxx —无法建立输出文件xxx107: Unable to open include file xxx —无法打开被包含的文件xxx 108: Unable to open input file xxx —无法打开输入文件xxx109: Undefined label xxx —没有定义的标号xxx110: Undefined structure xxx —没有定义的结构xxx111: Undefined symbol xxx —没有定义的符号xxx112: Unexpected end of file in comment started on line xxx —从xxx行开始的注解尚未结束文件不能结束113: Unexpected end of file in conditional started on line xxx —从xxx 开始的条件语句尚未结束文件不能结束114: Unknown assemble instruction —未知的汇编结构115: Unknown option —未知的操作116: Unknown preprocessor directive: xxx —不认识的预处理命令xxx 117: Unreachable code —无路可达的代码118: Unterminated string or character constant —字符串缺少引号119: User break —用户强行中断了程序120: Void functions may not return a value —Void类型的函数不应有返回值121: Wrong number of arguments —调用函数的参数数目错122: xxx not an argument —xxx不是参数123: xxx not part of structure —xxx不是结构体的一部分124: xxx statement missing ( —xxx语句缺少左括号125: xxx statement missing ) —xxx语句缺少右括号126: xxx statement missing ; —xxx缺少分号127: xxx declared but never used —说明了xxx但没有使用128: xxx is assigned a value which is never used —给xxx赋了值但未用过。

C语言编程时常犯的17种错误

C语言编程时常犯的17种错误

C语言编程时常犯的17种错误C语言编程时常犯的错误1、书写标识符时,忽略了大小写字母的区别。

main(){ int a=5; printf("%d",A);}编译程序把a和A认为是两个不同的变量名,而显示出错信息。

C认为大写字母和小写字母是两个不同的字符。

习惯上,符号常量名用大写,变量名用小写表示,以增加可读性。

2、忽略了变量的类型,进行了不合法的运算。

代码如下:main(){ float a,b; printf("%d",a%b);}%是求余运算,得到a/b的整余数。

整型变量a和b可以进行求余运算,而实型变量则不允许进行“求余”运算。

3、将字符常量与字符串常量混淆。

char c;c=”a”;在这里就混淆了字符常量与字符串常量,字符常量是由一对单引号括起来的单个字符,字符串常量是一对双引号括起来的字符序列。

C规定以“\”作字符串结束标志,它是由系统自动加上的,所以字符串“a”实际上包含两个字符:‘a’和‘’,而把它赋给一个字符变量是不行的。

4、忽略了“=”与“==”的区别。

在许多高级语言中,用“=”符号作为关系运算符“等于”。

如在BASIC 程序中可以写if (a=3) then …但C语言中,“=”是赋值运算符,“==”是关系运算符。

如:if (a==3) a=b;前者是进行比较,a是否和3相等,后者表示如果a和3相等,把b值赋给a。

由于习惯问题,初学者往往会犯这样的错误。

5、忘记加分号。

分号是C语句中不可缺少的一部分,语句末尾必须有分号。

a=1b=2编译时,编译程序在“a=1”后面没发现分号,就把下一行“b=2”也作为上一行语句的一部分,这就会出现语法错误。

改错时,有时在被指出有错的一行中未发现错误,就需要看一下上一行是否漏掉了分号。

代码如下:{ z=x+y; t=z/100; printf("%f",t);}对于复合语句来说,最后一个语句中最后的分号不能忽略不写(这是和PASCAL不同的)。

C语言编译、运行时常见错误

C语言编译、运行时常见错误

Turbo C编译、连接和运行时的常见错误&C语言编程风格一、编译时的常见错误1. 数据类型错误。

此类错误是初学者编程时的常见现象, 下面是一些要引起注意的错误:(1) 所有变量和常量必须要加以说明。

(2) 变量只能赋给相同类型的数据。

(3) 对scanf()语句, 用户可能输入错误类型的数据项, 这将导致运行时出错, 并报出错信息。

为避免这样的错误出现, 你就提示用户输入正确类型的数据。

(4) 在执行算术运算时要注意:a. 根据语法规则书写双精度数字。

要写0.5, 而不是写.5; 要写1.0,而不是1。

尽管C语言会自动地把整型转换成双精度型, 但书写双精度型是个好习惯。

让C语言为你做强行转换这是一种效率不高的程序设计风格。

这有可能导致转换产生错误。

b. 不要用0除。

这是一个灾难性的错误, 它会导致程序失败, 不管C语言的什么版本, 都是如此, 执行除法运算要特别小心。

c. 确保所有的双精度数(包括那些程序输入用的双精度数) 是在实数范围之内。

d. 所有整数必须在整数允许的范围内。

这适用于所有计算结果, 包括中间结果。

2. 将函数后面的";"忘掉。

此时错误提示色棒将停在该语句下的一行, 并显示:Statement missing ; in function <函数名>3. 给宏指令如#include, #define等语句尾加了";"号。

4. "{"和"}"、"("和")"、"/*"和"*/"不匹配。

引时色棒将位于错误所在的行, 并提示出有关丢掉括号的信息。

5. 没有用#include指令说明头文件, 错误信息提示有关该函数所使用的参数未定义。

6. 使用了Turbo C保留关键字作为标识符, 此时将提示定义了太多数据类型。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

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的数值。

?Possible use of ‘XXX’before definition表达式中使用了未赋值的变量? Redeclaration of ‘main’一个程序文件中主函数main不止一个。

? Suspicious pointer conversion 可疑的指针转换。

通常是使用了基本类型不匹配的指针。

? Unreachable code 程序含有不能执行到的代码。

(2) 错误或致命错误? Compound statement missing } in function main 程序结尾缺少括号}。

?“}”expected;“(”expected等复合语句或数组初始化的结尾缺少“)”;“(”。

? Case outside of switch case 不属于Switch结构,多由于switch结构中的花括号不配对所致。

?Case statement missing ‘:’ switch结构中的某个case之后缺少冒号。

? Constant expression required 定义数组时指定的数组长度不是常量表达式。

? Declaration syntax error 结构体或联合类型的定义后缺少分号。

? Declaration was expected 缺少说明,通常是因为缺少分界符如逗号、分号、右圆括号等所引起的。

? Default outside switch Default部分放到了switch结构之外,一般是因为花括号不匹配而引起的。

? do statement must have while do语句中缺少相应的while部分。

? Expression syntax 表达式语法错。

如表达式中含有两个连续的运算符?Extra parameter in call ‘fun’调用函数fun时给出了多余的实参。

? Function should return a value 函数应该返回一个值,否则与定义时的说明类型不匹配。

? Illegal use of pointer 指针被非法引用,一般是使用了非法的指针运算。

? Invalid pointer addition 指针相加非法。

一个指针(地址)可以和一个整数相加,但两个指针不能相加。

? Lvalue required 赋值运算的左边是不能寻址的表达式。

? Misplaced else 程序遇到了没有配对的else? No matching 表达式中的括号不配对。

? Pointer required on left side of_> 在“_>”运算的左边只能允许一个指针而不能是一个一般的结构体变量或联合类型的变量。

? Statement missing;程序遇到了后面没有分号的语句。

? Too few parameters in call 调用某个函数时实参数目不够。

?Unable to open include file ‘XXXXXXXX.XXX’头文件找不到。

? Unexpected }或:或{ 在不希望的地方使用了}或:{。

?Undefined symbol ‘X’in funct ion fun 函数fun中的变量X没有定义。

连接中的常见错误主要错误类似于“undefined symbol _print in modula xxx”(print没有定义),通常是函数名书写错误。

运行中的常见错误?Abnormal program termination 程序异常终止。

通常是由于内存使用不当所致。

?Floating point error : Domain 或Divide by 0 运算结果不是一个数或被0 除?Null pointer assignment 对未初始化的指针赋值,程序有严重错误。

?User break 在运行程序时终止。

继续1."c" not an argument in function sum 该标识符不是函数的参数2.array bounds missing ] in function main 缺少数组界限符 "]"3.Array size too large in function main 数组规模太大4.bad file name format in include directive 在包含指令中的文件名格式不正确.5.Call of non-function in function main 调用未经过定义的函数.6.cannot modify a const object in function main 对常量不能进行修改.7.character constant too long in function main 字符常量太大8.constant expression required in funtion main 数组定义的时候,数组大小要求是常数pound statment missing } in function main 复合语句漏掉符号 "{"10.declaration syntax error in function main 宣告语法错误11.expression syntax in function main 表达式语法错误12. extra parameter in call to sum in function 调用函数时使用了过多的参数13.illegal use of floating point in function main 浮点数的不合法使用14.illegal pionter subtraction in function main 不合法的指针相减15.invalid pointer addition in function main 无效的指针相加16.out of memory in function main 内存不足17.statement missing ; in function main 语句后面漏掉分号.警告报错1."k" is assigned a value which is never used 定义了一个变量,但程序从来没用过2.possibiy incorrect assignment in function main 这样的赋值可能不正确3. suspicious pointer conversion in function main 可疑的指针转换4.code has no effect in funtion main 代码对程序没效果Ambiguous operators need parentheses:不明确的运算需要用括号括起Ambiguous 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有语法错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 error :Case 语法错误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 :不允许转换近指针Could 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 :枚举类型语法错误Enumeration 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 :函数必需返回一个值Goto statement missing label :Goto语句没有标号Hexadecimal or octal constant too large :16进制或8进制常数太大Illegal character 'x' :非法字符xIllegal initialization :非法的初始化Illegal octal digit :非法的8进制数字Illegal pointer subtraction :非法的指针相减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 :不相容的类型转换Incorrect number format :错误的数据格式Incorrect use of defaultDefault使用不当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 definition 定义中参数个数不匹配Misplaced break 此处不应出现break语句Misplaced continue 此处不应出现continue语句Misplaced decimal point 此处不应出现小数点Misplaced elif directive 不应编译预处理elifMisplaced else 此处不应出现elseMisplaced else directive 此处不应出现编译预处理elseMisplaced endif directive 此处不应出现编译预处理endifMust be addressable 必须是可以编址的Must take address of memory location 必须存储定位的地址No declaration for function 'xxx' 没有函数xxx的说明No stack 缺少堆栈No type information 没有类型信息Non-portable pointer assignment 不可移动的指针(地址常数)赋值Non-portable pointer comparison 不可移动的指针(地址常数)比较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 definition 在定义之前就使用了xxx(警告)Possibly incorrect assignment 赋值可能不正确Redeclaration of 'xxx' 重复定义了xxxRedefinition of 'xxx' is not identical xx的两次定义不一致Register allocation failure 寄存器定址失败Repeat count needs an lvalue 重复计数需要逻辑值Size of structure or array not known 结构体或数给大小不确定Statement missing ; 语句后缺少";"Structure 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语句中一个)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 两个连续的句点Type mismatch in parameter xxx 数xxx类型不匹配Type mismatch in redeclaration of 'xxx' xx重定义的类型不匹配Unable to create output file 'xxx' 无法建立输出文件xxxUnable to open include file 'xxx' 无法打开被包含的文件xxxUnable to open input file 'xxx' 无法打开输入文件xxxUndefined label 'xxx' 没有定义的标号xxxUndefined structure 'xxx' 没有定义的结构xxxUndefined symbol 'xxx' 没有定义的符号xxxUnexpected 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' 不认识的预处理命令xxxUnreachable 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 结构体的长度为零。

相关文档
最新文档