C语言各类提示错误的含义

合集下载

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中单引号中左圆括号‘(’使用错误,两函数没有定义。

16种C语言编译警告(Warning)类型的解决方法

16种C语言编译警告(Warning)类型的解决方法

16种C语言编译警告(Warning)类型的解决方法当编译程序发现程序中某个地方有疑问,可能有问题时就会给出一个警告信息。

警告信息可能意味着程序中隐含的大错误,也可能确实没有问题。

对于警告的正确处理方式应该是:尽可能地消除之。

对于编译程序给出的每个警告都应该仔细分析,看看是否真的有问题。

只有那些确实无问题的警告才能放下不管。

说明:由于编译的警告各种各样,根本不可以一一罗列出来,下面只是列举出比较典型的一些警告,还有一些警告,大家只要根据字面意思,就可以很快的查找出来,并解决之。

类型1:显示:warning: implicit declaration of function 'Example()'。

警告原因:在你的.c文件中调用了函数Example(),可是你并没有把声明这个函数的相应的.h文件包含进来。

有可能你在一个.c文件中定义了这个函数体,但并没有在.h中进行声明。

解决方法:你可以在调用这种函数的.c文件的一开始处加上:extern Example();你可以在调用这种函数的.c文件中包含进声明了函数Example()的头文件。

如果你在一个.c文件中定义了这个函数体,但并没有在.h中进行声明,不嫌麻烦的话,你也可以去生成一个.h文件,加上你的函数声明。

类似的警告:warning: type mismatch with previous implicit declarationwarning: type mismatch with previous implicit declarationwarning: previous implicit declaration of 'Example()'类型2:显示:warning: unused variable 'param'。

警告原因:很明显,是您定义了变量‘param',却根本没有使用它。

解决方法:不需要用的话,就删了它吧。

c语言 syntax error

c语言 syntax error

c语言 syntax errorC语言是一种广泛应用的编程语言,但是在编写代码的过程中,很容易出现语法错误,也就是所谓的syntax error。

本文将以C语言syntax error为主题,探讨一些常见的语法错误,并介绍如何避免和解决这些错误。

让我们了解一下什么是syntax error。

在C语言中,每条语句都必须遵循一定的语法规则,如果违反了这些规则,编译器就会报错并指出错误的位置。

这些错误被称为syntax error,意味着代码的语法有错误,无法被正确编译和执行。

常见的syntax error包括括号不匹配、缺少分号、变量未声明等。

下面我们将逐一介绍这些错误,并给出相应的解决方法。

首先是括号不匹配的错误。

在C语言中,括号的使用非常重要,它们用于表示代码的块结构和参数的传递。

如果括号不匹配,就会导致语法错误。

例如,如果一个函数的括号没有正确的闭合,编译器将会报错。

解决这个问题的方法是仔细检查代码,确保每个左括号都有相应的右括号与之匹配。

其次是缺少分号的错误。

在C语言中,分号是语句结束的标志,如果缺少分号,编译器将会报错。

例如,在赋值语句的末尾缺少分号,编译器将会提示“缺少分号”错误。

解决这个问题的方法是仔细检查代码,确保每个语句的末尾都有分号。

还有一种常见的错误是变量未声明。

在C语言中,使用变量之前必须先声明它们的类型和名称。

如果使用了未声明的变量,编译器将会报错。

例如,如果尝试使用一个没有声明的变量作为函数的参数,编译器将会提示“未声明的标识符”错误。

解决这个问题的方法是在使用变量之前先声明它们。

除了以上介绍的几种常见的syntax error,还有一些其他的错误,如函数调用错误、运算符错误等。

解决这些错误的方法是仔细检查代码,确保函数调用的参数与函数定义的参数一致,运算符的使用符合语法规则。

为了避免syntax error的发生,我们可以采取一些预防措施。

首先是规范化的代码风格。

良好的代码风格可以使代码更易读、易于维护,并减少语法错误的出现。

c语言程序调试中错误或警告提示的中文对照概要

c语言程序调试中错误或警告提示的中文对照概要

C语言错误提示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'' ------------------ 非法字符 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 typedefsymbol ----------------种类定义符号使用不合适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 -------------------- 不应编译预办理 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 -------- 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'' -------------- 无法建立输出文件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 ( -------------------- 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 ------------------ 结构体的长度为零警告类错误1‘ XXX’ declare but never used变量 XXX 已定义但从未用过。

如何解决C语言中的编译错误与警告

如何解决C语言中的编译错误与警告

如何解决C语言中的编译错误与警告C语言是一种广泛应用于系统编程和嵌入式开发的编程语言,它的编译过程中常常会出现各种错误和警告。

这些错误和警告可能会导致程序无法正确编译或者在运行时出现问题。

因此,解决C语言中的编译错误与警告是每个程序员都需要掌握的重要技能。

本文将介绍一些常见的编译错误和警告,并提供一些解决方法。

一、理解编译错误和警告的含义在解决编译错误和警告之前,我们首先需要理解它们的含义。

编译错误是指在编译过程中发现的语法错误或者逻辑错误,这些错误会导致程序无法正确编译。

编译警告是指在编译过程中发现的一些潜在的问题,虽然不会导致程序无法编译,但可能会导致程序在运行时出现问题。

二、常见的编译错误和警告1. 语法错误:语法错误是最常见的编译错误之一,它通常是由于编程人员在编写代码时遗漏了分号、括号不匹配等导致的。

解决语法错误的方法是仔细检查代码,确保语法正确。

2. 未声明的标识符:当使用一个未声明的标识符时,编译器会报错。

解决这个问题的方法是在使用标识符之前先进行声明或者引入相应的头文件。

3. 类型不匹配:类型不匹配是指在赋值或者函数调用过程中,变量的类型与期望的类型不一致。

解决这个问题的方法是检查变量的类型,并进行相应的类型转换。

4. 未使用的变量:编译器会对未使用的变量发出警告,这可能是由于代码中存在一些无用的变量。

解决这个问题的方法是删除未使用的变量或者对其进行使用。

5. 未初始化的变量:未初始化的变量可能导致程序在运行时出现未定义的行为。

解决这个问题的方法是在使用变量之前先进行初始化。

6. 函数返回值不匹配:函数的返回值类型与函数定义时声明的返回值类型不一致会导致编译错误。

解决这个问题的方法是检查函数的返回值类型,并进行相应的修改。

7. 潜在的内存泄漏:编译器可能会对未释放的内存发出警告,这可能会导致内存泄漏。

解决这个问题的方法是在使用完内存后及时释放。

三、解决编译错误和警告的方法1. 仔细阅读编译错误和警告信息:编译器通常会提供详细的错误和警告信息,我们应该仔细阅读这些信息,找出问题所在。

C语言常见错误中英文对照表(已经排版好,直接打印)

C语言常见错误中英文对照表(已经排版好,直接打印)
errorC2086: 'xxx' : redefinition中文对照:标识符xxx重定义
分析:变量名、数组名重名
errorC2087: '<Unknown>' : missing subscript中文对照:下标未知
分析:一般是定义二维数组时未指定第二维的长度,例如“int a[3][];”
errorC2100: illegal indirection中文对照:非法的间接访问运算符“*”
errorC2082: redefinition of formal parameter 'xxx'中文对照:重复定义形式参数xxx
分析:函数首部中的形式参数不能在函数体中再次被定义
errorC2084: function 'xxx' already has a body中文对照:已定义函数xxx
分析:在VC++早期版本中函数不能重名,6.0中支持函数的重载,函数名相同但参数不一样
需正确定义变量类型数据类型1为float或double数据类型2为int时结果有可能1为double数据类型2为float时不影响程序结果可忽略该警告不正确数据类型warningc4305
常见错误中英文对照表
fatal errorC1003: error count exceeds number; stopping compilation中文对照:错误太多,停止编译分析:修改之前的错误,再次编译
分析:可能缺少“{”、“)”或“;”等语言符号
: missing ')' before type 'xxx'中文对照:在xxx类型前缺少‘)’
分析:一般是函数调用时定义了实参的类型

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语言编译、运行时常见错误

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)。

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 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----------------------此处不应出现elseMisplaced else directive------------------此处不应出现编译预处理else Misplaced 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''-------------------重复定义了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''---------------无法打开被包含的文件xxxUnable 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''-----------------不认识的预处理命令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(--------------------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------------------结构体的长度为零rcon mp_autoteambalance0rcon mp limitteams0。

相关文档
最新文档