C语言调试功能以及常见错误提示详解

C语言调试功能以及常见错误提示详解
C语言调试功能以及常见错误提示详解

C语言编译环境中的

调试功能及常见错误提示

调试功能

1.常用健

: 激活系统菜单

: 将光标在编辑窗口和、信息窗口之间切换

: 加载一个文件

+ : 查看程序运行结果

: 得到有关编辑器在线帮助

+ : 得到有关C语言的在线帮助

+ : 终止正在运行的程序

2.块操作

KB: 定义块首

KK: 定义块尾

KV: 块移动

KC: 块复制

KY: 块删除

KH: 取消块定义

3.查找、替换和删除操作

QF: 查找字符串

QA: 查找并替换字符串

Option: G(全程),B(向文件头),N(直接替换) Y : 删除一行

QY: 删除从光标位置到行末的所有字符

编译中的常见错误例析

(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 function fun 函数fun中的变量X没有定义。

5.连接中的常见错误

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

6.运行中的常见错误

Abnormal program termination程序异常终止。通常是由于内存使用不当所致。

Floating point error : Domain 或Divide by 0运算结果不是一个数或被0 除

Null pointer assignment 对未初始化的指针赋值,程序有严重错误。

User break在运行程序时终止。

7.程序的跟踪调试

利用Run菜单可以进行程序的跟踪调试

(1)GO to Cursor ()——选择该选项使程序执行到光标所在行

首先将光标移到某行(一般为可执行),选择该功能项,则程序执行到该行的前一行暂停。此时程序处于跟踪调试状态,并有亮条

显示在暂停处,此时可以查询变量或表达式的值。

(2)Trace into ()——执行一条语句或一行暂停

此时程序处于跟踪调试状态,并有亮条显示在暂停处。该选项可跟踪到被调函数的内部。

(3)Step over ()——执行一条语句或一行暂停

此时程序处于跟踪调试状态,并有亮条显示在暂停处。该选项将自定义函数当作一个语句执行,不跟踪到函程序的内部。

(4)Debug菜单

程序处于跟踪状态时,可使用该菜单的选项。

其主要是使用Evaluate——目的是查询或更新变量或表达式的值。

选择Evaluate功能后,系统弹出一个对话框。该对话框包含三个选项区域:Evaluate域可以输入一个含有目前代码中(程序暂

停区的作用域)正在使用的变量名、或含变量的表达式、或常量表达

式。按回车键后,在Result域中显示变量或表达式的值。还可以用

New value域进行调试。

如果调试程序时发现Result域显示的某变量或表达式的值不正确,并能估计出该变量或表达式的值,则可以将该值输入到New

value域,继续执行程序,其目的是肯定错误发生处是否在当前位置

之前。如果输入这个正确的值并将程序继续执行完毕而结果正确,说

明在目前暂停处之前已经发生错误而之后无错误。

(5)Break/Watch——用于设置断点和监视表达式。

选择Add Watch功能选项,系统将弹出一个菜单,在Add Watch框中输入变量名或表达式,按回车键后,系统在屏幕底部开辟

一个窗口并显示该变量或表达式的值。

【常见错误信息语句索引】

Ambiguous operators need parentheses:不明确的运算需要用括号括起Ambiguous symbol 'xxx' :不明确的符号

Argument list syntax error:参数表语法错误

Array bounds missing ] in function main 缺少数组界限符"]"

Array bounds missing :丢失数组界限符

Array size too large :数组尺寸太大

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 不应编译预处理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 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' 无法建立输出文件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 结构体的长度为零

【注意】1.不同编译环境的功能或提示可能有差异;

2.部分说明为“经验性”的,仅供参考.

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.下述标识符中,()是合法的用户标识符。 A.A#C B.getch C.void D.ab* 2.在C语言中,字符型数据在内存中是以()形式存放的。 A.原码 B.BCD码 C.反码 D.ASCII码 3.以下选项中不合法的用户标识符是()。 A.abc.c B.file C.Main D.PRONTF 4.以下选项中不合法的用户标识符是()。 A.123 B.printf C.Anbsp; D.Dim 5.可以在C语言程序中用做用户标识符的一组标识符是()。 A.void B.as-b3 C.for D.2c define -123 -abc Do WORD If cas SIG 6.在以下各组标识符中,合法的用户标识符是(1)、(2)、(3)。 (1)A.001 B.table_1 C.0_t D.k% Int t*.1 W10 point (2)A.Fast_ B.void C.pbl D. Fast+Big abs fabs beep (3)A.xy_ B.longdouble C.*p D.CHAR 变量1 signed history Float 7.()是构成C语言的基本单位。 A.函数 B.过程 C.子程序 D.子例程 8.若有说明:char s1='\067';char s2="1";char s3='1';则s1中(1),s2中(2),s3中(3)。

(1).A.包含3个字符 B.包含2个字符 C.包含1个字符 D.无定值,说明不合法 (2).A.包含1个字符 B.包含2个字符 C.包含3个字符 D.无定值,说明不合法 (3).A.包含1个字符 B.包含2个字符 C.包含3个字符 D.无定值,说明不合法 9.若x为int型变量,则执行以下语句后,x的值为 x=6; x+=x-=x*x A.36 B.-60 C.60 D.-24 10.在C语言中,char 型数据在内存中是以()形式存储的。 A.原码 B.补码 C.ASCII码 D.反码 11.以下运算符中优先级最低的算符为(),优先级最高的为()。 A.&& B.& C.|= D.|| E.?: F.!= 12.若有运算符>、*=、<<、%、sizeof,则它们按优先级(由低至高)的正确排列顺序为 A.*= << > % sizeof B.<< *= > % sizeof C.*= > << sizeof % D.*= > << % sizeof 13.若有以下类型说明语句 char w; int x; float y; double z; 则表达式w*x+z-y 的结果是()类型。 A.float B.char C.int D.double 14.若w,x,y,z 均为int 型变量,则执行下面的语句后, w=(1), x=(2), y=(3), z=(4)。 w=5; x=4; y=w++*w++*w++; z=--x*=--x*--x;

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的数值。 ?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 缺少说明,通常是因为缺少分界符如逗号、分号、右圆括号等所引起的。

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/3f4649695.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内存不足

C语言常见错误分析汇总

C语言常见错误分析汇总 1、 在一个工程里出现两个main函数时 3.obj : error LNK2005: _main already defined in file1.obj Debug/HELLO.exe : fatal error LNK1169: one or more multiply defined symbols found 这个就是说,你的main函数重定义了。你看看是不是你的工程里面,包含了很多个有main函数的文件? 2、 fatal error C1010: unexpected end of file while looking for precompiled header directive 出现这个错误的原因是,工程类型建错了,应该选择win 32 console application 3、拼写错误 (1)#include //头文件拼写错了 void main() { printf("doeifweofupwp"); } fatal error C1083: Cannot open include file: 'stido.h': No such file or directory (2)#inculde //include拼写错了 void main() { printf("doeifweofupwp"); } fatal error C1021: invalid preprocessor command 'inculde'(无效的预编译命令inculde) (3)#include void mian() //main拼写错了 { printf("doeifweofupwp"); }

C语言调试时出现的错误及调整方法

VC中LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16错误2009-10-09 11:11 学习VC++时经常会遇到链接错误LNK2001,而一般说来发生连接错误时,编译都已通过。产生连接错误的原因非常多,尤其LNK2001错误,常常使人不明其所以然。产生 LNK2001错误的原因:一个是由于编码错误导致的LNK2001,在这不想详细说.另一个由于编译和链接的设置而造成的LNK2001.最经常发生的是:"LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol",产生这个错误的原因是没有为wWinMainCRTStartup设定程序入口. 认识这个错误首先在新建工程时要分清Win32 Application和Win32 Console Application.它们都是工作在32位Windows环境的程序.其中Win32 Application 就是普通的常见的窗口应用程序,当然有的界面做得比较 个性化,比如圆形的、不规则形状的.它们都是所谓的GUI(Graphics User Interface图形用户接口),我们可以通过鼠标点击来完成控制。而Win32 Console Application (win32控制台应用程序)往往是像MS-DOS窗口(XP中叫命令提示符)的样子出现,我们得用键盘输入各种命令来使用它,或者叫CUI(Character User Interface字符用户接 口)。 遇到如下链接错误: Linking... /subsystem:windows LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 Debug/TestWin.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. 解决方法是:将project-settings-link的project options里的/subsystem:windows 改成/subsystem:console 因为Win32 Application的入口函数为WinMain Win32 Console Application的入口函数是main 也就是说,如果你编写传统的C程序,必须建立Win32 Console程序,但VC里面默认的是Win32 Application,于是上面提及的链接错误就就经常出现了 而Win32 Application和Win32 Console的区别就在于VC里链接参数不同 另外几种error LNK2001错误: 在创建MFC项目时, 不使用MFC AppWizard向导, 如果没有设置好项目参数, 就会在编译时产生很多连接错误, 如error LNK2001错误, 典型的错误提示有: libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16 msvcrtd.lib(crtexew.obj) : error LNK2001: unresolved external symbol _WinMain@16 nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __beginthreadex nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol __endthreadex 下面介绍解决的方法: 1. Windows子系统设置错误, 提示: libcmtd.lib(crt0.obj) : error LNK2001: unresolved external symbol _main

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

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 非法的初始化

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

C语言常见错误提示

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 -> 符号->的左边必须是指针

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/3f4649695.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 :不允许转换近指针

c语言错误调试大全

A Ambiguous operators need parentheses 不明确的运算需要用括号括起。二义性操作符需要括号,但两个移位、关系或按位操作符在一起使用而不加括号时,发现此警告;但一个加法或减法操作符不加括号而与一个移位操作符出现在一起时,也发出此警告。 Ambiguous symbol ''xxx'' 不明确的符号,二义性符号…xxxxxxxx?。两个或多个结构的某一域名相同,但具有的偏移、类型不同。在变量或表达式中引用该域而未带结构名时,将产生二义性,此时需修改某个域名或在引用时加上结构名。 Argument list syntax error 参数表语法错误参数表出现语法错误。函数调用时,参数与参数之间必须以逗号隔开,并以一右括号结束。若源文件中含有一个其后不是逗号也不是右括号的参数,则出错。 Argument #missing name 参数#名丢失。参数名已脱离用于定义函数的函数原型,如果函数以原型定义,该函数必须包括所有的参数名。 Array bounds missing 丢失数组界限符数组的界限符…]?丢失。原因是在源文件中定义了一个数组,但此数组没有以一右方括号结束。, Array size toolarge 数组尺寸太大,数组长度太长。定义的数组太大,而可用内存不够。Assembler startement too long 汇编语句太长。内部汇编语句最长不能超过480个字节。 B Bad call of in line function 内部函数非法调用 在使用一个宏定义的内部函数时,没有正确调用。一个内部函数以下划双线(_)开始和结束。 Bad character in paramenters 参数中有不适当的字符 Bad configuration file 配置文件不正确。Turboc.cfg配置文件中包含不是合适命令行选择项非注解文字。 配置文件命令选择项必须以一短横线开始。 Bad file name format in include directive 包含命令中文件名格式不正确使用include指令时,文件名格式不正确。include 文件名必须用引号或尖括号括起来。例如:include "stdio.h"或include ,否则将

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

龙源期刊网 https://www.360docs.net/doc/3f4649695.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语言的显著特点是功能比较强、使用方便且灵活,而且对语法的检查不像其他的语言那样严格。这些显

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

相关文档
最新文档