c常见错误编译提示

c常见错误编译提示
c常见错误编译提示

转换时会丢失意义的数字

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

不应编译预处理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 结构体的长度为零

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 包含命令中文件名格式不正确

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 转换时会丢失意义的数Could not find file ''xxx'' 找不到XXX文件Declaration missing 说明缺少";"

Declaration syntax error 说明中出现语法错误

Default outside of switch Default出现在switch语句之外Define directive needs an identifier

define命令需要标识符Division by zero 用零作除数

Do statement must have while Do语句中需要while部分Enum syntax error 枚举类型语法错误

Enumeration constant syntax error 枚举常数语法错误Error directive: xxx 错误的编译预处理命令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 函数必需返回一个值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 typedef 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 需要左值

Macro argument syntax error 宏参数语法错误Macro expansion too long 宏的扩展以后太长

Mismatched number of parameters in definition 定义中参数个数不匹配

Misplaced break 此处不应出现break语句Misplaced continue 此处不应出现continue语句Misplaced decimal point 此处不应出现小数点Misplaced else 此处不应出现else 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 寄存器定址失败

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'' 不认识的预处理命令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 结构体的长度为零

参考网址:

https://www.360docs.net/doc/8312718732.html,/f?kz=369371298 https://www.360docs.net/doc/8312718732.html,/~jlli/c/c-errors.html

https://www.360docs.net/doc/8312718732.html,/roverlibertine/article/details/1858736

https://www.360docs.net/doc/8312718732.html, 百度在线翻译https://www.360docs.net/doc/8312718732.html, 谷歌在线翻译

https://www.360docs.net/doc/8312718732.html,/viewthread-31-427311-1.shtml 爱词霸沙龙-编程词汇英汉对照

C语言错误提示常用词(完善中…)

英文

中文

英文

中文

addition 加法incorrect

不正确的address 地址

initialization, initializer 初始化ambiguous 不明确的,有歧义的input 输入argument 参数invalid 无效的array 数组line 行assign 分配

list 列表

bit (二进制的)位lvalue左值(可置于赋值号左边的数据,如变量)bound (数组的)边界macro 宏call 调用(函数)memory 内存character 字符mismatched 不匹配的command 命令misplaced 错位的comment 注释missing 缺少const, constant 常量modify 修改conversion 转换

name 名称create 建立(文件等)object 对象decimal 十进制的octal

八进制decimal point 小数点operation,operate 操作declare, declaration 声明out of range 超出范围digit 数字output 输出directive 指令parameter

参数division 除法parenthesis,parentheses 圆括号dot 点pointer 指针duplicate 不唯一的requires 要求enum,enumeration 枚举

statement 语句execute 执行(命令,程序)structure 结构体expression 表达式subscripting 下标extra 多余的subtraction 减法file 文件symbol 符号format 格式syntax error 语法错误function 函数type 类型hexadecimal 十六进制undefined 未定义的identifier 标识符unexpected 意外的illegal 非法的unknown 未知的improper 不恰当的value 值incompatible

不相容的

c语言编译常见错误列表

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.360docs.net/doc/8312718732.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 语句后面漏掉分号. 警告报错

KEIL51调试时一些的错误总结

KEIL51调试时一些的错误总结 (1)提示无M51文件 编译时候提示: F:\...\XX.M51 File has been changed outside the editor, reload ? ------ 解决方法: 重新生成项目,产生STARTUP.A51即可。 (2)L15重复调用 ***WARNING L15: MULTIPLE CALL TO SEGMENT SEGMENT: ?PR?SPI_RECEIVE_WORD?D_SPI CALLER1: ?PR?VSYNC_INTERRUPT?MAIN CALLER2: ?C_C51STARTUP 该警告表示连接器发现有一个函数可能会被主函数和一个中断服务程序(或者调用中断服务程序的函数)同时调用,或者同时被多个中断服务程序调用。 出现这种问题的原因之一是这个函数是不可重入性函数,当该函数运行时它可能会被一个中断打断,从而使得结果发生变化并可能会引起一些变量形式的冲突(即引起函数内一些数据的丢失,可重入性函数在任何时候都可以被ISR 打断,一段时间后又可以 运行,但是相应数据不会丢失)。 原因之二是用于局部变量和变量(暂且这样翻译,arguments,[自变量,变元一数值,用于确定程序或子程序的值])的内存区被其他函数的内存区所覆盖,如果该函数被中断,则它的内存区就会被使用,这将导致其他函数的内存冲突。 例如,第一个警告中函数WRITE_GMVLX1_REG 在D_GMVLX1.C 或者 D_GMVLX1.A51被定义,它被一个中断服务程序或者一个调用了中断服务程序的 函数调用了,调用它的函数是VSYNC_INTERRUPT,在MAIN.C中。 解决方法: 如果你确定两个函数决不会在同一时间执行(该函数被主程序调用并且中断被禁止),并且该函数不占用内存(假设只使用寄存器),则你可以完全忽略这种警告。 如果该函数占用了内存,则应该使用连接器(linker)OVERLAY指令将函数从覆盖分析(overlay analysis)中除去,例如: OVERLAY (?PR?_WRITE_GMVLX1_REG?D_GMVLX1 ! *) 上面的指令防止了该函数使用的内存区被其他函数覆盖。如果该函数中调用了其他函数,而这些被调用在程序中其他地方也被调用,你可能会需要也将这些函数排除在覆盖分析(overlay analysis)之外。这种OVERLAY指令能使编译器除去上述警告信息。 如果函数可以在其执行时被调用,则情况会变得更复杂一些。这时可以采用以下几种方法:

C语言中常见的错误

."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.360docs.net/doc/8312718732.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内存不足

编译原理教程课西安电子科大出版社第三版后习题答案——第二章

第二章 词法分析 2.1 完成下列选择题: (1) 词法分析器的输出结果是 。 a. 单词的种别编码 b. 单词在符号表中的位置 c. 单词的种别编码和自身值 d. 单词自身值 (2) 正规式M1和M2等价是指 。 a. M1和M2的状态数相等 b. M1和M2的有向边条数相等 c. M1和M2所识别的语言集相等 d. M1和M2状态数和有向边条数相等 (3) DFA M(见图2-1)接受的字集为 。 a. 以0开头的二进制数组成的集合 b. 以0结尾的二进制数组成的集合 c. 含奇数个0的二进制数组成的集合 d. 含偶数个0的二进制数组成的集合 【解答】 (1) c (2) c (3) d 图2-1 习题2.1的DFA M 2.2 什么是扫描器?扫描器的功能是什么? 【解答】 扫描器就是词法分析器,它接受输入的源程序,对源程序进行词法分析并识别出一个个单词符号,其输出结果是单词符号,供语法分析器使用。通常是把词法分析器作为一个子程序,每当词法分析器需要一个单词符号时就调用这个子程序。每次调用时,词法分析器就从输入串中识别出一个单词符号交给语法分析器。 2.3 设M=({x,y}, {a,b}, f, x, {y})为一非确定的有限自动机,其中f 定义如下: f(x,a)={x,y} f{x,b}={y} f(y,a)=Φ f{y,b}={x,y} 试构造相应的确定有限自动机M ′。 【解答】 对照自动机的定义M=(S,Σ,f,So,Z),由f 的定义可知f(x,a)、f(y,b)均为多值函数,因此M 是一非确定有限自动机。 先画出NFA M 相应的状态图,如图2-2所示。 图2-2 习题2.3的NFA M 用子集法构造状态转换矩阵,如表 表2-1 状态转换矩阵 1b a

C语言调试常见错误及修改方法(附习题)

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 后的变量或表达式错误(此时可通过看题意,来分析该返回哪一变量或表达式)

Keil C 编译器常见警告与错误信息

https://www.360docs.net/doc/8312718732.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语言调试常见错误

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:

C语言编译中的常见错误

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 表达式语法错。如表达式中含有两个连续的运算符

KEIL常见编译错误大全

KEIL常见编译错误大全 【致命错误】 立即终止编译这些错误通常是命令行指定的无效选项的结果当编译器不 能访问一个特定的源包含文件时也产生致命错误 致命错误信息采用下面的格式 C51FATAL-ERROR– ACTION: LINE: ERROR: C51TERMIANTED. C51FATAL-ERROR– ACTION: FILE: ERROR: C51TERMIANTED. 下面说明Action和Error中可能的内容 Actions ALLOCATING MEMORY 编译器不能分配足够的存储区来编译指定的源文件. CREATING LIST-FILE/OBJECT-FILE/WORKFILE 编译器不能建立列表文件,OBJ文件,或工作文件这个错误的出现可能是磁盘满或写保护,或文件已存在和只读. GENERATING INTERMEDIATE CODE 源文件包含的一个函数太大,不能被编译器编译成虚拟代码.尝试把函数分小或重新编译. OPENING INPUT-FILE 编译器不能发现或打开所选的源或包含文件. PARSING INVOKE-/#PRAGMA-LINE 当在命令行检测到参数计算,或在一个#pragma中检测到参数计算,就产生这样的错误. PARSING SOURCE-FILE/ANALYZING DECLARATIONS 源文件包含太多的外部参考.减少源文件访问的外部变量和函数的数目. WRITING TO FILE

Keil编译常见问题

Error: L6200E Error: L6200E: Symbol temp multiply defined (by and .在编译的时候出现了这个问题,但是检查不出来,希望各位大侠帮帮忙 什么变量你给付了两次值 你看看是不是那个外部变量你又给赋值了 申明,其他.c文件对应的.h文件中用extern引用 error: #20 error: #20: identifier "TIM2_IRQChannel" is undefined 谁能说说,哪里错了 你的固件库里的库文件没有添加进工程里面,所以出现未定义的情况。 TIM2_IRQChannel指定时器2的中断通道没有定义,其实在固件库对这些参数都有定义,宏定义代替了一串寄存器地址数据。需要将.C文件添加到工程文件中 warning: #1-D (7): warning: #1-D: last line of file ends without a newline 当使用keil编译时,弹出这样的警告信息:(7): warning: #1-D: last line of file ends without a newline 这个是由于在main函数的“}”后,没有加回车。 只要在main函数的“}”后加回车键,此警告信息即可消除。 error:#65 ...(27):error:#65:expected a ";"

分数送你了,问题在你回答之前已经解决了,头文件里的结构体定义里的最后一行没有加";" 如NB menu{..}; error:#1113: 折腾了大半天,才搞明白一个空操作的指令 先在网上查有的说是__asm{NOP;},从里调用,可犄角旮旯全找了,也没看到什么的文件。如果直接用,就出现error:#1113:InlineassemblernotpermittedwhengeneratingThumbcode 最后搜索这条错误,知道是因为__asm("指令");这种语法是内联汇编(inlineassembly)的语法。而RMDK下,内联汇编仅支持ARM汇编语言,不支持Thumb或者Thumb-2汇编语言;但内嵌汇编器支持Thumb和Thumb-2。 __asm放到一个单独的子函数再被调用就没问题了 如下: __asmvoidnop(void) { NOP } 然后在之后的C代码中调用该函数: voidmain() { ... nop(); ...? }

c语言中常见的错误

."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.360docs.net/doc/8312718732.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 :不允许转换近指针

编译出错种类

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”没有初始化就使用。

Keil编程常见错误

uint i, j; uchar a = 0xfe; EA = 1; EX0 = 1;不能这样 EA = 1; EX0 = 1; uint i, j; uchar a = 0xfe; 否则出现外部中断.C(18): error C141: syntax error near 'unsigned' 外部中断.C(18): error C202: 'i': undefined identifier 外部中断.C(19): error C141: syntax error near 'unsigned' 外部中断.C(19): error C202: 'a': undefined identifier 外部中断.C(23): error C202: 'i': undefined identifier 外部中断.C(27): error C202: 'a': undefined identifier 外部中断.C(29): error C202: 'a': undefined identifier 外部中断.C(31): error C202: 'i': undefined identifier 外部中断.c - 8 Error(s), 0 Warning(s). 原因:顺序问题,keil中的顺序 外部中断和内部中断的区别是什么; 外部中断是在单片机的外面给单片机一个信号单片机收到这个信号开始中断这是外部中断 内部中断是通过软件把中断打开执行中断

error c236:‘——display’:different length of parameter lists参数列表的长度不同。 检查开始的函数声明和这定义的参数是否一致。 还有参数没说明类型 有很大的区别, 错误3 unreferenced local variable 是未使用定义的变量,就是你定义了但是没有使用。 错误4 syntax error语法错误。 电平触发方式是按照电平的高或者低来触发,所以用的时候,必须在发生触发事件后立即将电平拉到非触发电平上,如果不这样做的话,会导致程序一直在触发事件程序入口处,而不会执行其他地方的程序。所以一般比较少用。 边沿触发方式是按照(上或下)边沿触发事件,由于触发的条件是边沿(上或下),所以即使在触发事件后,保存原来的电平都没有关系,不会一直在触发的,一般都用这种方式。 错误5 #define uchar unsigned char 不能写成 #define unsigned char uchar 否则出现会出现很多错误 错误6 不能这样定义字符数组 int a = “wwwsad”只能用char 错误7 error C244: 'table':can't initialize, bad type or class 。意思是错误的或者坏的类

常见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 ) 函数调用缺少右括号

西电软件学院算法实验报告

第二次试验 一、 问题: Matrix-chain product 分析: 本题是矩阵链乘问题,需要求出最优括号化方案。即在矩阵的乘法链上添加括号来改变运算顺序以使矩阵链乘法的代价降低。 可以分析该链乘的一个子段总结一些结论。假设m[i,j]表示A i*…*A j的链成需要进行的乘法次数(假设j-i足够大),我们可以将A i*…*A j分为两段进行计算:(A i*…*A k)*(A k+1*…*A j)可以得出m[i,j]的递推公式 可以得出,当i=j的时候,m[i,j]=0。当i为例,可以得出如下矩阵:

通过m数组可以得出最少的乘法次数,通过s数组可以输出最优方案。 遇到的问题: 在输出s数组的结果的时候仍然需要递归调用,需要合适的控制递归的条件。 总结: 在矩阵链乘问题中可以看出,动态规划结合递归的思想可以快捷的解决很多问题。本题中,重点是归纳出m[i,j]的递推公式。 二、 问题: Longest Common Subsequence 分析: 本题即是最长公共子序列问题。假设有序列A[m]和序列B[n],显然,对于每一个[i,j],都对应着一个公共子序列的长度。假设长度为c,就可以得到一个二维数组c[m,n]。对于c[i,j],当Ai=Bj的时候,问题就转变为求A[1..i-1]和B[1..j-1]的公共子序列长度的问题,所以c[i,j]的长度就是c[i-1,j-1] + 1; 同理,当Ai != Bj的时候,c[i,j]应该在c[i-1,j]与c[i,j-1]中取最大值。另外,当i或者j等于0的时候,显然c的值为0。由上面所述,可以得到递推公式如下: 为了解决这个问题,还如要定义另一个数组用于存放c数组中每一个元素的来源。这个来源其实就反映了公共子串。可以通过箭头表示来源,相连的箭头序列中指向左上方的箭头最多的一串对应的就是最长公共子序列。 比如对于题目中给出的第一个例子 X: xzyzzyx Y: zxyyzxz 可以用一个矩阵表示计算的过程:

分析C语言编程中常见错误及解决办法

龙源期刊网 https://www.360docs.net/doc/8312718732.html, 分析C语言编程中常见错误及解决办法 作者:胡金荣 来源:《数码设计》2018年第03期 摘要:C语言是计算机基础教学中被广泛利用的一种教学语言,是目前计算机技术应用的重要内容,利用C语言程序的编写可以为办公自动化提供更为便捷的条件,因此强调其在具体实践中的利用现实意义显著。在学习应用C语言编程发现其在实践中存在着一些比较常见的错误,这些错误对办公质量和效率有重要的影响,所以要对其进行有效的解决。本文就C语言编程中常见的错误和解决方法做具体分析,旨在指导实践工作,提升编程的效率和质量。 关键词:C语言编程;常见错误;解决办法 中图分类号:TP312.1 文献标识码:A 文章编号:1672-9129(2018)03-0021-02 Analyze Common Mistakes in C Language Programming and Solutions HU Jinrong* (Xinjiang Shihezi Engineering Technology School, Xinjiang Shihezi, 832000, China) Abstract:C language is a widely used teaching language in computer basic education. It is an important content of computer technology application. The use of C language program can provide more convenient conditions for office automation. Therefore, it emphasizes its practice. The use of real significance in the. Learning to use the C language programming found that there are some common mistakes in practice, these errors have an important impact on office quality and efficiency, so we must effectively solve it. This article analyzes the common mistakes and solutions in C language programming and aims to guide practical work and improve the efficiency and quality of programming. Keywords:C programming; common mistakes; solutions 引用:胡金荣. 分析C语言编程中常见错误及解决办法[J]. 数码设计, 2018, 7(3): 21-22. Cite:HU Jinrong. Analyze Common Mistakes in C Language Programming and Solutions[J]. Peak Data Science, 2018, 7(3): 21-22. 引言 C语言是计算机基础教学中被广泛利用的一种教学语言,从具体的分析来看,C语言的显著特点是功能比较强、使用方便且灵活,而且对语法的检查不像其他的语言那样严格。这些显

相关文档
最新文档