Turbo C(V2.0)编译错误信息C语言常见的出错信息
Ambiguous operators need parentheses
不明确的运算需要用括号括起
Ambiguous symbol ''xxx''
不明确的符号
Argument list syntax error
参数表语法错误
Array bounds missing
丢失数组界限符
Array size too large
数组尺寸太大
Bad character in parameters
参数中有不适当的字符
Bad file name format in include directive
包含命令中文件名格式不正确
Bad ifdef directive syntax
编译预处理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 )
函数调用缺少右括号
Function definition out of place
函数定义位置错误
Function should return a value
函数必需返回一个值
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
非法的指针相减
Illegal structure operation
非法的结构体操作
Illegal use of floating point
非法的浮点运算
Illegal use of pointer
指针使用非法
Improper use of a type def symbol
类型定义符号使用不恰当
In-line assembly not allowed
不允许使用行间汇编
Incompatible storage class
存储类别不相容
Incompatible type conversion
不相容的类型转换
Incorrect 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 definition 定义中参数个数不匹配
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 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''
重复定义了xxx
Redefinition of ''xxx'' is not identical xxx的两次定义不一致
Register allocation failure
寄存器定址失败
Repeat count needs an lvalue
重复计数需要逻辑值
Size of structure or array not known
结构体或数给大小不确定
Statement missing ;
语句后缺少";"
Structure or union syntax error
结构体或联合体语法错误
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'' xxx重定义的类型不匹配
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
Undefined 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 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 (
xxx语句缺少左括号
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
结构体的长度为零
KEIL常见编译错误大全 【致命错误】 立即终止编译这些错误通常是命令行指定的无效选项的结果当编译器不 能访问一个特定的源包含文件时也产生致命错误 致命错误信息采用下面的格式 C51FATAL-ERROR– ACTION:
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 incorrect assignment这样的赋值可能不正确 ?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 表达式语法错。如表达式中含有两个连续的运算符
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 数组定义的时候,数组大小要求是常数 https://www.doczj.com/doc/be519303.html,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 语句后面漏掉分号. 警告报错
."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数组定义的时候,数组大小要求是常数 https://www.doczj.com/doc/be519303.html,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内存不足
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 ) 函数调用缺少右括号
g c c常见的编译警告与错误(按字母顺序排 列)
gcc 常见的编译警告与错误(按字母顺序排列) C语言初学者遇到的最大问题往往是看不懂编译错误,进而不知如何修改程序。有鉴于此,本附录罗列了用gcc编译程序时经常出现的编译警告与错误。需要提醒读者的是,出现警告(warning)并不影响目标程序的生成,但出现错误(error)则无法生成目标程序。 为便于读者查阅,下面列出了经常遇到的警告与错误,给出了中英文对照(英文按字典顺序排列),并对部分错误与警告做了必要的解释。 #%s expects \FILENAME\ or … #%s 需要 \FILENAME\ 或… #%s is a deprecated GCC extension #%s 是一个已过时的 GCC 扩展 #%s is a GCC extension #%s 是一个 GCC 扩展 #~ error: #~ 错误: #~ In file included from %s:%u #~ 在包含自 %s:%u 的文件中 #~ internal error: #~ 内部错误: #~ no newline at end of file #~ 文件未以空白行结束
#~ warning: #~ 警告: #elif after #else #elif 出现在 #else 后 #elif without #if #elif 没有匹配的 #if #else after #else #else 出现在 #else 后 #else without #if #else 没有匹配的 #if #endif without #if #endif 没有匹配的 #if #include nested too deeply #include 嵌套过深 #include_next in primary source file #include_next 出现在主源文件中 #pragma %s %s is already registered #pragma %s %s 已经被注册 #pragma %s is already registered #pragma %s 已经被注册 #pragma once in main file #pragma once 出现在主文件中
1.调试 C 程序时常见的错误类型分析 一般情况下,错误主要分为两大类:一、语法错误。对于这种错误,用编译器很容易解决。所以,改错题的第一步是先编译,解决这类语法错误。下面总结了二级C 语言上机改错题中常见的语法错误: (1) 丢失分号,或分号误写成逗号。 (2) 关键字拼写错误,如本来小写变成大写。 (3) 语句格式错误,例如for 语句中多写或者少写分号。 (4) 表达式声明错误,例如:少了() (5) 函数类型说明错误。与main ()函数中不一致。 (6) 函数形参类型声明错误。例如:少* 等。 (7) 运算符书写错误,例如:/ 写成了。二、逻辑错误,或者叫语义错误,这和实现程序功能紧密相关,一般不能用编译器发现。对于逻辑错误可以按这样的步骤进行查找。 (1) 先读试题,看清题目的功能要求。 (2) 通读程序,看懂程序中算法的实现方法。 (3) 细看程序,发现常见错误点。 2.改错题的改错方式总结,当然这些总结只能对大部分改错行有效 1、若错误行是函数首部,可分为以下几种情况: A、该行最后若有分号则删除,中间若有分号则改成逗号 B、形参类型不一致的问题,特别是指针类型,若后面用到某形参时有指针运算则该形参必为指针类型;若形参是二维数组或指向m 个元素的指针变量,则第二维的长度必须与main 中对应数组的第二维长度相同 C、函数类型不一致的问题,若函数中没有return语句则函数类型为void,若有return语句则函数的类型必须与return 后变量的类型一致。 2、若错误行是if 或while 语句,则首先看有没有用小括号将整个表达式括起,若没有则加上小括号。 3、若错误行中有if、while 、for 则要特别注意条件表达式的错误问题: A、指针变量的应用,若表达式中有指针变量且没有指针运算符,则加上指针运算符 B、若条件表达式中只有一个等于号,则改成两个等于号,若为其它比较运算符则一般是进行逆转或加一个等于号 C、f or 中要用分号分隔表达式,而不是用逗号 4、语法错误 A、语句缺少分号,若错误行中有语句没有用分号结束,则加上分号。 B、大小写不对,若错误行中有大写字母则一般都改成小写字母。 5、指针变量的运用,若错误行中有指针变量,并且该变量名前没有指针运算符则一般都是加上指针运算符 6、若错误行为return 语句,则首先看是否是缺少分号若是则加上分号即可;否则就是return 后的变量或表达式错误(此时可通过看题意,来分析该返回哪一变量或表达式)
C语言调试常见错误 一、第一类错误分析 1在使用变量前未定义。 例如: main() {a=1; b=2; printf(″%d\n″, a+b); } 2语句后面漏写分号或不该加分号的地方加了分号。 C语言规定,语句必须以分号结束,分号是C语句不可缺少的一部分,这也是和其它高级语言不同的一点。初学者往往容易忽略这个分号。 如: x=1 y=2; 又如在复合语句中漏写最后一个语句的分号: {t=x; x=y; y=t } 3不该有空格的地方加了空格 例如,在用/*...*/对C程序中的任何部分作注释时,/与*之间都不应当有空格。 又如,在关系运算符<=,>=,==和!=中,两个符号之间也不允许有空格。 4定义或引用数组的方式不对。 C语言规定,在对数组进行定义或对数组元素进行引用时必须要用方括号(对二维数组或多维数组的每一维数据都必须分别用方括号括起来),例如以下写法都将造成编译时出错: int a(10); int b[5,4]; printf(″%d\n″, b[1+2,2]); 5混淆字符和字符串 C语言中的字符常量是由一对单引号括起来的单个字符;而字符串常量是用一对双引号括起来的字符序列。字符常量存放在字符型变量中,而字符串常量只能存放在字符型数组中。例如, 假设已说明num是字符型变量,则以下赋值语句是非法的: num=″1″; 6在引用数组元素或指针变量之前没对其赋初值。 例如: main() main() {int a[6],b; {int *ptr, i=1; b=a[5]; *ptr=i
┇ ┇ }} 以上两个程序段在编译时均会出现警告信息。 7混淆数组名与指针变量 在C语言中,数组名代表数组的首地址,它的值是一个常量,不能被修改。例如,在以下程序段中,用a++是不合法的。 main() {int i, a[10]; for (i=0;i<10;i++) scanf(″%d″, a++); ┇ } 8混淆不同类型的指针。 若有以下语句: int *p1, a=1; float *p2; p1=&a; 则赋值语句p2=p1是非法的。 9混淆指针说明语句中的*号和执行语句中的*号。 设有以下说明语句: int *p1, i=1; 则 *p1=&i;是不合法的。 10误将函数形参和函数中的局部变量一起定义。 例如: fun(x,y) float x, y, z; {x++; y++; z=x+y; ┇ } 11所调用的函数在调用前未定义。 main() {float a=10, b=20, c; c=fun(a,b); ┇ } float fun(x, y) float x, y; {x++; y++; ┇ } 12混淆结构体类型名和结构体变量名。 若定义了以下结构体类型student:
【转】IAR常见编译错误—比较全 IAR常见编译错误,比较全面的: 前面的序号表示错误编号 0 Format chosen cannot support banking Format unable to support banking. 1 Corrupt file. Unexpected end of file in module module (file) encountered XLINK aborts immediately. Recompile or reassemble, or check the compatibility between XLINK and C compiler. 2 Too many errors encountered (>100) XLINK aborts immediately. 3 Corrupt file. Checksum failed in module module (file). Linker checksum is linkcheck, module checksum is modcheck XLINK aborts immediately. Recompile or reassemble. 4 Corrupt file. Zero length identifier encountered in module module (file) XLINK aborts immediately. Recompile or reassemble. 5 Address type for CPU incorrect. Error encountered in module module (file) XLINK aborts immediately. Check that you are using the right files and libraries. 6 Program module module redeclared in file file. Ignoring second module XLINK will not produce code unless the Always generate output (-B) option (forced dump) is used. 7 Corrupt file. Unexpected UBROF – format end of file encountered in module module (file) XLINK aborts immediately. Recompile or reassemble. 8 Corrupt file. Unknown or misplaced tag encountered in module module (file). Tag tag XLINK aborts immediately. Recompile or reassemble. 9 Corrupt file. Module module start unexpected in file file XLINK aborts immediately. Recompile or reassemble. 10 Corrupt file. Segment no. segno declared twice in module module (file) XLINK aborts immediately. Recompile or reassemble. 11 Corrupt file. External no. ext no declared twice in module module (file) XLINK aborts immediately. Recompile or reassemble. 12 Unable to open file file XLINK aborts immediately. If you are using the command line, check the
常见gcc 编译错误整理(开始)1 1 error: expected expression before 'else' else之前无表达式。 2 error: lvalue required as left operand of assignment 左值问题。 3 error: invalid storage class for function 'XXXXXX' 在文件的某个地方,丢失了一个大括号‘}’。 常见gcc编译警告整理(开始) 1、warning: no newline at end of file 在文件最后一行加上回车键 解释:在《Rationale for the C99 standard》一文中,有C99的相关信息: A backslash immediately before a newline has long been used to continue string literals, as well as preprocessing command lines. In the interest of easing machine generation of C, and of transporting code to machines with restrictive physical line lengths, the C89 Committee generalized this mechanism to permit any token to be continued by interposing a backslash/newline sequence. c/c++代码的每一行后面有一个“结束符”,也就是newline。避免当被include的文件展开后,前一个文件的最后一行与后一个文件的第一行直接被连接成一行从而造成错误。 2、warning: comparison between pointer and integer 解释:integer与pointer比较
目录 VC6.0编译常见错误 (1) 第一部分编译错误 (1) 1.error C2001: newline in constant (1) 2.error C2015: too many characters in constant (2) 3.error C2018: unknown character '0x##' (3) 4.error C2041: illegal digit '#' for base '8' (3) 5.error C2065: 'xxxx' : undeclared identifier (3) 6.error C2086: 'xxxx' : redefinition (5) 7.error C2374: 'xxxx' : redefinition; multiple initialization (5) 8.C2143: syntax error : missing ';' before (identifier) 'xxxx' (5) 9.error C2137: empty character constant (6) 10.error C2374: 'xxxx' : redefinition; multiple initialization (7) 第二部分链接错误 (7) 1.error LNK2001: unresolved external symbol _main (7) 2.error LNK2005: _main already defined in xxxx.obj (7) VC6.0编译常见错误 第一部分编译错误 1.error C2001: newline in constant 编号:C2001 直译:在常量中出现了换行。错误分析: (1)字符串常量、字符常量中是否有换行。
https://www.doczj.com/doc/be519303.html,/support/man/docs/c51/c51_c277.htm错误信息查询 Keil C 编译器常见警告与错误信息 error C132 :“****”not in formal parameter list 花了偶将近半个小时来查找错误,最终发现原来是在头文件里的一个函数声明时露了一个分号造成紧挨着在它下面声明的参数not in formal parameter list。 记在在这里,免得以后忘记了,同时也供大家分享。 下面是另外一些常见的错误提示: 1.第一种错误信息 ***WARNING L15: MULTIPLE CALL TO SEGMENT SEGMENT: ?PR?_WRITE_GMVLX1_REG?D_GMVLX1 CALLER1: ?PR?VSYNC_INTERRUPT?MAIN CALLER2: ?C_C51STARTUP ***WARNING L15: MULTIPLE CALL TO SEGMENT SEGMENT: ?PR?_SPI_SEND_WORD?D_SPI CALLER1: ?PR?VSYNC_INTERRUPT?MAIN CALLER2: ?C_C51STARTUP ***WARNING L15: MULTIPLE CALL TO SEGMENT SEGMENT: ?PR?SPI_RECEIVE_WORD?D_SPI CALLER1: ?PR?VSYNC_INTERRUPT?MAIN CALLER2: ?C_C51STARTUP - 该警告表示连接器发现有一个函数可能会被主函数和一个中断服务程序(或者调用中断服务程序的函数)同时调用,
."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 数组定义的时候,数组大小要求是常数 https://www.doczj.com/doc/be519303.html,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 :不允许转换近指针
一、编译时的常见错误 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保留关键字作为标识符, 此时将提示定义了太多数据类型。 7. 将定义变量语句放在了执行语句后面。此时会提示语法错误。 8. 使用了未定义的变量, 此时屏幕显示: Undefined symbol '<变量名>' in function <函数名> 9. 警告错误太多。忽略这些警告错误并不影响程序的执行和结果。编译时当警告错误数目大于某一规定值时(缺省为100)便退出编译器, 这时应改变集成开发环境Options/Compiler/Errors中的有关警告错误检查开关为off。 10. 将关系符"=="误用作赋值号"="。此时屏幕显示: Lvalue required in function <函数名> 二、连接时的常见错误 1. 将Turbo C库函数名写错。这种情况下在连接时将会认为此函数是用户自定义函数。此时屏幕显示: Undefined symbol '<函数名>' in <程序名> 2. 多个文件连接时, 没有在"Project/Project name中指定项目文件(.PRJ文件), 此时出现找不到函数的错误。 3. 子函数在说明和定义时类型不一致。 4. 程序调用的子函数没有定义。 三、运行时的常见错误 1. 路径名错误。在MS-DOS中, 斜杠(\)表示一个目录名; 而在Turbo C 中斜杠是个某个字符串的一个转义字符, 这样, 在用Turbo C 字符串给出一个路径名时应考虑"\"的转义的作用。例如, 有这样一条语句: file=fopen("c:\new\tbc.dat", "rb"); 目的是打开C盘中NEW目录中的TBC.DAT文件, 但做不到。这里"\"后面紧接的分别是"n"及"t", "\n"及"\t"将被分别编译为换行及tab字符, DOS将认为它是不正确的文件名而拒绝接受, 因为文件名中不能和换行或tab字符。正确的写法应为: file=fopen("c:\\new\\tbc.dat", "rb"); 2. 格式化输入输出时, 规定的类型与变量本身的类型不一致。例如: float l;
VC++编译的常见错误 1、fatal error C1010: unexpected end of file while looking for precompiled header directive。 寻找预编译头文件路径时遇到了不该遇到的文件尾。(一般是没有#include "stdafx.h") 2、fatal error C1083: Cannot open include file: 'R…….h': No such file or directory 不能打开包含文件“R…….h”:没有这样的文件或目录。 3、error C2011: 'C……': 'class' type redefinition 类“C……”重定义。 4、error C2018: unknown character '0xa3' 不认识的字符'0xa3'。(一般是汉字或中文标点符号) 5、error C2057: expected constant expression 希望是常量表达式。(一般出现在switch语句的case分支中) 6、error C2065: 'IDD_MYDIALOG' : undeclared identifier “IDD_MYDIALOG”:未声明过的标识符。 7、error C2082: redefinition of formal parameter 'bReset' 函数参数“bReset”在函数体中重定义。 8、error C2143: syntax error: missing ':' before '{' 句法错误:“{”前缺少“;”。 9、error C2146: syntax error : missing ';' before identifier 'dc' 句法错误:在“dc”前丢了“;”。 10、error C2196: case value '69' already used 值69已经用过。(一般出现在switch语句的case分支中) 11、error C2509: 'OnTimer' : member function not declared in 'CHelloView' 成员函数“OnTimer”没有在“CHelloView”中声明。 12、error C2511: 'reset': overloaded member function 'void (int)' not found in 'B' 重载的函数“void reset(int)”在类“B”中找不到。 13、error C2555: 'B::f1': overriding virtual function differs from 'A::f1' only by return type or calling convention 类B对类A中同名函数f1的重载仅根据返回值或调用约定上的区别。 14、error C2660: 'SetTimer' : function does not take 2 parameters “SetTimer”函数不传递2个参数。 15、warning C4035: 'f……': no return value “f……”的return语句没有返回值。 16、warning C4553: '= =' : operator has no effect; did you intend '='? 没有效果的运算符“= =”;是否改为“=”? 17、warning C4700: local variable 'bReset' used without having been initialized 局部变量“bReset”没有初始化就使用。
Java编译错误信息及说明 1、java:33:不是语句 解释:程序中出现了没有任何意义的字符(串),可能是无意中打出了没有任何意义的字符; 2、java:34:需要';' 解释:某条语句没有以分号结束; 3、java:36:缺少返回语句 解释:带返回值的函数缺少return语句; 4、java:33:不兼容的类型 解释:运算符两边的数据类型不一致或者不能做隐式转换; 5、java:36:无法访问的语句 解释:此语句永远不可能被执行,可能是此语句之前存在类似于while(true)的语句,导致此语句永远不可能被执行; 6、java:34:非法的表达式开始 解释:有不符合语法规范的表达式出现; 7、java:34:找不到符号 解释:使用了没有定义或没有引入的变量; 8、java:33:非法字符:\65307 解释:在中文输入状态下输入了一些标点符号; 9、java:18:不可转换的类型 解释:运算符两边的数据类型不一致或者不能做隐式转换; 10、java:19:"else"不带有"if" 解释:编译器找到else语句但是没有找到与之对应的if语句,可能是由于大括号没有成对出现;
11、java:12:可能损失精度 解释:把高精确度类型的数据赋值给低精确度类型的变量; 12、java:17:需要')' 解释:括号没有成对出现; 13、java:8:可能尚未初始化变量s 解释:局部变量s没有赋初值; 14、java:7:不可比较的类型:int和Boolean 解释:运算符两边操作数的数据类型不符合运算符的使用规范; 15、java:6:已在isLeap(int)中定义year 解释:变量year被重复定义; 16、java:21:字符字面值的行结尾不合法 解释:程序语句的结尾不是java规定的结束符号,而是其他的符号; 17、java:9:需要<标识符> 解释:可能是由于用户指定了数据类型,但未指定该类型的变量名; 18、java:8:无法从静态上下文中引用非静态变量this 解释:在静态方法中使用了非静态变量this; 19、java:12:在switch或loop外部中断 解释:在非循环语句或非switch语句中使用了中断循环功能的语句break; 20、java:21:对于结果类型为void的方法,无法返回值 解释:空返回值方法中出现了return语句; 21、java:12:需要数组,但找到int 解释:在应该出现数组的地方没有找到数组类型的变量,而是找到int类型的变量; 22、java:13:无法将Node中的setData(int)应用于()