C语言常见错误中英文对照表
C语言常见错误中英文对照表(网络搜索及经验积累不断更新中)
常见错误中英文对照表
fatal error C1003: error count exceeds number; stopping compilation
中文对照:错误太多,停止编译
分析:修改之前的错误,再次编译
fatal error C1004: unexpected end of file found
中文对照:文件未结束 分析:一个函数或者一个结构定义缺少“}”、或者在一个函数调用或表达式中括号没有配对出现、或者注释符“/*…*/”不完整等
fatal error C1083: Cannot open include file: 'xxx': No such file or
directory 中文对照:无法打开头文件xxx:没有这个文件或路径 分析:头文件不存在、或者头文件拼写错误、或者文件为只读
fatal error C1903: unable to recover from previous error(s); stopping
compilation 中文对照:无法从之前的错误中恢复,停止编译 分析:引起错误的原因很多,建议先修改之前的错误
error C2001: newline in constant
中文对照:常量中创建新行 分析:字符串常量多行书写
error C2006: #include expected a filename, found 'identifier'
中文对照:#include命令中需要文件名
分析:一般是头文件未用一对双引号或尖括号括起来,例如“#include stdio.h”
error C2007: #define syntax
中文对照:#define语法错误 分析:例如“#define”后缺少宏名,例如“#define”
error C2008: 'xxx' : unexpected in macro definition
中文对照:宏定义时出现了意外的xxx 分析:宏定义时宏名与替换串之间应有空格,例如“#define TRUE"1"”
error C2009: reuse of macro formal 'identifier'
中文对照:带参宏的形式参数重复使用 分析:宏定义如有参数不能重名,例如“#define s(a,a) (a*a)”中参数a重复
error C2010:
'character' : unexpected in macro formal parameter list 中文对照:带参宏的参数表表现未知字符
分析:例如“#define s(r|) r*r”中参数多了一个字符‘|’
error C2014: preprocessor command must start as first nonwhite space
中文对照:预处理命令前面只允许空格
分析:每一条预处理命令都应独占一行,不应出现其他非空格字符
error C2015: too many characters in constant
中文对照:常量中包含多个字符
分析:字符型常量的单引号中只能有一个字符,或是以
“\”开始的一个转义字符
error C2017: illegal escape sequence
中文对照:转义字符非法 分析:一般是转义字符位于 ' ' 或 " " 之外,例如“char error = ' '\n;”
error C2018: unknown character '0xhh'
中文对照:未知的字符0xhh 分析:一般是输入了中文标点符号,例如“char error = 'E';”中“;”为中文标点符号
error C2019: expected preprocessor directive, found 'character'
中文对照:期待预处理命令,但有无效字符
分析:一般是预处理命令的#号后误输入其他无效字符,例如“#!define TRUE 1”
error C2021: expected exponent value, not 'character'
中文对照:期待指数值,不能是字符 分析:一般是浮点数的指数表示形式有误,例如123.456E
error C2039: 'identifier1' : is not a member of 'idenifier2'
中文对照:标识符1不是标识符的成员
分析:程序错误地调用或引用结构体、共用体、类的成员
error C2048: more than one default
中文对照:default语句多于一个 分析:switch语句中只能有一个default,删去多余的default
error C2050: switch expression not integral
中文对照:switch表达式不是整型的 分析:switch表达式必须是整型(或字符型),例如“switch ("a")”中表达式为字符串,这是非法的
error C2051: case expression not constant
中文对照:case表达式不是常量 分析:case表达式应为常量表达式,例如“case "a"”中“"a"”为字符串,这是非法的
error C2052: 'type' : illegal type for case expression
中文对照:case表达式类型非法 分析:case表达式必须是一个整型常量(包括字符型)
error C2057: expected constant expression
中文对照:期待常量表达式 分析:一般是定义数组时数组长度为变量,例如“int n=10; int a;”中n为变量,是非法的
error C2058: constant expression is not integral
中文对照:常量表达式不是整数 分析:一般是定义数组时数组长度不是整型常量
error C2059: syntax error : 'xxx'
中文对照:‘xxx’语法错误 分析:引起错误的原因很多,可能多加或少加了符号xxx
error C2064: term does not evaluate to a function
中文对照:无法识别函数语言 分析:1、函数参数有误,表达式可能不正确,例如“sqrt(s(s-a)(s-b)(s-c));”中表达式不正确
2、变量与函数重名或该标识符不是函数,例如“int i,j; j=i();”中i不是函数
error C2065: 'xxx' : undeclared identifier
常见连接错误
(1) vc网络编程中遇到一个编译问题,原来是少了WSOCK32.LIB。
在 project-->settings-->Link-->Object/Library modules 中加入库WSOCK32.LIB即可。
在VC中进行WINSOCK的API编程开发的时候,需要在项目中使用下面三个文件,否则会出现编译错误。
1.WINSOCK.H: 这是WINSOCK API的头文件,需要包含在项目中。
2.WSOCK32.LIB: WINSOCK API连接库文件。在使用中,一定要把它作为项目的非缺省的连接库包含到项目文件中去。
3.WINSOCK.DLL: WINSOCK的动态连接库,位于WINDOWS的安装目录下。
--------------------Configuration: Example1 - Win32 Debug--------------------
Linking...
error LNK2001: unresolved external symbol _connect@12
error LNK2001: unresolved external symbol _htons@4
error LNK2001: unresolved external symbol _inet_addr@4
error LNK2001: unresolved external symbol _socket@12
error LNK2001: unresolved external symbol _closesocket@4
error LNK2001: unresolved external symbol _send@16
error LNK2001: unresolved external symbol _recv@16
error LNK2001: unresolved external symbol _WSAAsyncSelect@16
error LNK2001: unresolved external symbol _accept@12
error LNK2001: unresolved external symbol _listen@8
error LNK2001: unresolved external symbol _bind@12
(2) vc数据库SQL编程中遇到一个问题,原来是少了odbc32.lib。
在 project-->settings-->Link-->Object/Library modules 中加入库odbc32.lib 即可。
mfc程序调用了odbc api,连接时出错:
error LNK2001: unresolved external symbol _SQLConnect@28
error LNK2001: unresolved external symbol _SQLFetch@4
error LNK2001: unresolved external symbol _SQLBindCol@24
error LNK2001: unresolved external symbol _SQLFreeHandle@8
error LNK2001: unresolved external symbol _SQLExecDirect@12
error LNK2001: unresolved external symbol _SQLAllocHandle@12
error LNK2001: unresolved external symbol _SQLSetEnvAttr@16
error LNK2001: unresolved external symbol _SQLDisconnect@4
(3) vc OpenCV图像处理编程中遇到一个问题,原来是少了cv.lib cvaux.lib cxcore.lib highgui.lib。
在 project-->settings-->Link-->Object/Library modules 中加入库cv.lib cvaux.lib
cxcore.lib highgui.lib 即可。
error LNK2001: unresolved external symbol _cvReleaseImage
error LNK2001: unresolved external symbol _cvWaitKey
error LNK2001: unresolved external symbol _cvDrawContours
error LNK2001: unresolved external symbol _cvReleaseMemStorage
error LNK2001: unresolved external symbol _cvDestroyWindow
error LNK2001: unresolved external symbol _cvFindContours
error LNK2001: unresolved external symbol _cvCvtColor
error LNK2001: unresolved external symbol _cvCreateImage
error LNK2001: unresolved external symbol _cvGetSize
error LNK2001: unresolved external symbol _cvShowImage
error LNK2001: unresolved external symbol _cvLoadImage
error LNK2001: unresolved external symbol _cvNamedWindow
error LNK2001: unresolved external symbol _cvCreateMemStorage
(4) vc OpenGL三维编程中遇到一个问题,原来是少了OpenGL32.lib GLu32.lib GLaux.lib。
在 project-->settings-->Link-->Object/Library modules 中加入库OpenGL32.lib GLu32.lib
GLaux.lib 即可。
error LNK2001: unresolved external symbol _gluPerspective@32
error LNK2001: unresolved external symbol _gluLookAt@72
error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
error LNK2001: unresolved external symbol __imp__glMatrixMode@4
error LNK2001: unresolved external symbol __imp__glViewport@16
error LNK2001: unresolved external symbol __imp__glHint@8
error LNK2001: unresolved external symbol __imp__glDepthFunc@4
error LNK2001: unresolved external symbol __imp__glEnable@4
error LNK2001: unresolved external symbol __imp__glClearDepth@8
error LNK2001: unresolved external symbol __imp__glClearColor@16
error LNK2001: unresolved external symbol __imp__glShadeModel@4
error LNK2001: unresolved external symbol __imp__glEnd@0
error LNK2001: unresolved external symbol __imp__glVertex3f@12
error LNK2001: unresolved external symbol __imp__glBegin@4
error LNK2001: unresolved external symbol __imp__glTranslatef@12
error LNK2001: unresolved external symbol __imp__glClear@4
error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
error LNK2001: unresolved external symbol __imp__wglCreateContext@4
(5) vc VFW视频采集编程中遇到一个问题,原来是少了VFW32.Lib
在 project-->settings-->Link-->Object/Library modules 中加入库VFW32.Lib 即可。
error LNK2001: unresolved external symbol _capCreateCaptureWindowA@32
中文对照:未定义的标识符xxx 分析:1、如果xxx为cout、cin、scanf、printf、sqrt等,则程序中包含头文件有误
2、未定义变量、数组、函数原型等,注意拼写错误或区分大小写。
error C2078: too many initializers
中文对照:初始值过多 分析:一般是数组初始化时初始值的个数大于数组长度,例如“int b={1,2,3};”
error C2082: redefinition of formal parameter 'xxx'
中文对照:重复定义形式参数xxx 分析:函数首部中的形式参数不能在函数体
中再次被定义
error C2084: function 'xxx' already has a body
中文对照:已定义函数xxx 分析:在VC++早期版本中函数不能重名,6.0中支持函数的重载,函数名相同但参数不一样
error C2086: 'xxx' : redefinition
中文对照:标识符xxx重定义 分析:变量名、数组名重名
error C2087: '<Unknown>' : missing subscript
中文对照:下标未知 分析:一般是定义二维数组时未指定第二维的长度,例如“int a[];”
error C2100: illegal indirection
中文对照:非法的间接访问运算符“*” 分析:对非指针变量使用“*”运算
error C2105: 'operator' needs l-value
中文对照:操作符需要左值 分析:例如“(a+b)++;”语句,“++”运算符无效
error C2106: 'operator': left operand must be l-value
中文对照:操作符的左操作数必须是左值 分析:例如“a+b=1;”语句,“=”运算符左值必须为变量,不能是表达式
error C2110: cannot add two pointers
中文对照:两个指针量不能相加 分析:例如“int *pa,*pb,*a; a = pa + pb;”中两个指针变量不能进行“+”运算
error C2117: 'xxx' : array bounds overflow
中文对照:数组xxx边界溢出 分析:一般是字符数组初始化时字符串长度大于字符数组长度,例如“char str = "abcd";”
error C2118: negative subscript or subscript is too large
中文对照:下标为负或下标太大 分析:一般是定义数组或引用数组元素时下标不正确
error C2124: divide or mod by zero
中文对照:被零除或对0求余分析:例如“int i = 1 / 0;”除数为0
error C2133: 'xxx' : unknown size
中文对照:数组xxx长度未知 分析:一般是定义数组时未初始化也未指定数组长度,例如“int a[];”
error C2137: empty character constant。
中文对照:字符型常量为空 分析:一对单引号“''”中不能没有任何字符
error C2143: syntax error : missing 'token1' before 'token2' error C2146:
syntax error : missing 'token1' before identifier 'identifier'
中文对照:在标识符或语言符号2前漏写语言符号1 分析:可能缺少“{”、“)”或“;”等语言符号
error C2144: syntax error : missing ')' before type 'xxx'
中文对照:在xxx类型前缺少‘)’ 分析:一般是函数调用时定义了实参的类型
error C2181: illegal else without matching if
中文对照:非法的没有与if相匹配的else 分析:可能多加了“;”或复合语句没有使用“{}”
error C2196: case value '0' already used
中文对照:case值0已使用 分析:case后常量表达式的值不能重复出现
error C2296: '%' : illegal, left operand has type 'float' error C2297: '%'
: illegal, right operand has type 'float' 中文对照:%运算的左(右)操作数类型为float,这是非法的
分析:求余运算的对象必须均为int类型,应正确定义变量类型或使用强制类型转换
error C2371: 'xxx' : redefinition; different basic types
中文对照:标识符xxx重定义;基类型不同 分析:定义变量、数组等时重名
error C2440: '=' : cannot convert from 'char ' to 'char'
中文对照:赋值运算,无法从字符数组转换为字符 分析:不能用字符串或字符数组对字符型数据赋值,更一般的情况,类型无法转换
error C2447: missing function header (old-style formal list?) error C2448:
'<Unknown>' : function-style initializer appears to be a function definition
中文对照:缺少函数标题(是否是老式的形式表?) 分析:函数定义不正确,函数首部的“( )”后多了分号或者采用了老式的C语言的形参表
error C2450: switch expression of type 'xxx' is illegal
中文对照:switch表达式为非法的xxx类型 分析:switch表达式类型应为int或char
error C2466: cannot allocate an array of constant size 0
中文对照:不能分配长度为0的数组 分析:一般是定义数组时数组长度为0
error C2601: 'xxx' : local function definitions are illegal
中文对照:函数xxx定义非法 分析:一般是在一个函数的函数体中定义另一个函数
error C2632: 'type1' followed by 'type2' is illegal
中文对照:类型1后紧接着类型2,这是非法的 分析:例如“int float i;”语句
error C2660: 'xxx' : function does not take n parameters
中文对照:函数xxx不能带n个参数 分析:调用函数时实参个数不对,例如“sin(x,y);”
error C2676: binary '<<' : 'class istream_withassign' does not define this
operator or a conversion to a type acceptable to the predefined operator error
C2676: binary '>>' : 'class ostream_withassign' does not define this operator
or a conversion to a type acceptable to the predefined operator
分析:“>>”、“<<”运算符使用错误,例如“cin<<x;
cout>>y;”
error C4716: 'xxx' : must return a value
中文对照:函数xxx必须返回一个值 分析:仅当函数类型为void时,才能使用没有返回值的返回命令。
fatal error LNK1104: cannot open file "Debug/Cpp1.exe"
中文对照:
无法打开文件Debug/Cpp1.exe 分析:重新编译链接
fatal error LNK1168: cannot open Debug/Cpp1.exe for writing
中文对照:不能打开Debug/Cpp1.exe文件 分析:一般是Cpp1.exe还在运行,未关闭
fatal error LNK1169: one or more multiply defined symbols found
中文对照:出现一个或更多的多重定义符号。
分析:一般与error LNK2005一同出现
error LNK2001: unresolved external symbol _main
中文对照:未处理的外部标识main 分析:一般是main拼写错误,例如“void mian()”
error LNK2005: _main already defined in Cpp1.obj
中文对照: main函数已经在Cpp1.obj文件中定义 分析:未关闭上一程序的工作空间,导致出现多个main函数
warning C4067: unexpected tokens following preprocessor directive - expected
a newline 中文对照:预处理命令后出现意外的符号 - 期待新行 分析:“#include<iostream.h>;”命令后的“;”为多余的字符
warning C4091: '' : ignored on left of 'type' when no variable is
declared中文:当没有声明变量时忽略类型说明 分析:语句“int ;”未定义任何变量,不影响程序执行
warning C4101: 'xxx' : unreferenced local variable
中文对照:变量xxx定义了但未使用 分析:可去掉该变量的定义,不影响程序执行
warning C4244: '=' : conversion from 'type1' to 'type2', possible loss of
data 中文对照:赋值运算,从数据类型1转换为数据类型2,可能丢失数据
分析:需正确定义变量类型,数据类型1为float或double、数据类型2为int时,结果有可能不正确,数据类型1为double、数据类型2为float时,不影响程序结果,可忽略该警告
warning C4305: 'initializing' : truncation from 'const double' to 'float'
中文对照:初始化,截取双精度常量为float类型
分析:出现在对float类型变量赋值时,一般不影响最终结果
warning C4390: ';' : empty controlled statement found; is this the intent?
中文对照:‘;’控制语句为空语句,是程序的意图吗?分析:if语句的分支或循环控制语句的循环体为空语句,一般是多加了“;”
warning C4508: 'xxx' : function should return a value; 'void' return type
assumed 中文对照:函数xxx应有返回值,假定返回类型为void 分析:一般是未定义main函数的类型为void,不影响程序执行
warning C4552: 'operator' : operator has no effect; expected operator with
side-effect 中文对照:运算符无效果;期待副作用的操作符
分析:例如“i+j;”语句,“+”运算无意义
warning C4553: '==' : operator has no effect; did you intend '='?
中文对照:
“==”运算符无效;是否为“=”? 分析:例如
“i==j;”
语句,“==”运算无意义
warning C4700: local variable 'xxx' used without having been initialized
中文对照:变量xxx在使用前未初始化
分析:变量未赋值,结果有可能不正确,如果变量通过scanf函数赋值,则有可能漏写“&”运算符,或变量通过cin赋值,语句有误
warning C4715: 'xxx' : not all control paths return a value
中文对照:函数xx不是所有控制路径都有返回值 分析:一般是在函数的if语句中包含return语句,当if语句的条件不成立时没有返回值
warning C4723: potential divide by 0
中文对照:有可能被0除 分析:表达式值为0时不能作为除数
分类: c/c++学习
C语言常见错误中英文对照表的更多相关文章
- C语言常见错误笔记
1. 职业化的程序员起码要具备两点: 1)基本的软件技能 2)不犯低级的错误 2. 修改函数的形参是没用的,函数本身占用的存储单元在堆栈中分配,入口参数的值会在函数入口处拷贝到堆栈中,一旦函数返回,其 ...
- [转]C语言常见错误总结1
指针与数组的对比c程序中,指针和数组在不少地方可以相互替换着用,让人产生一种错觉,以为两者是等价的 数组要么在静态存储区被创建(如全局数组),要么在栈上被创建.数组名对应着(而不是指向)一块内存,其地 ...
- 【原】GO 语言常见错误
1. Scan error on column index 4: converting string "" to a int: strconv.ParseInt: parsing ...
- C语言初学者代码中的常见错误与瑕疵(23)
见:C语言初学者代码中的常见错误与瑕疵(23)
- 一个超复杂的间接递归——C语言初学者代码中的常见错误与瑕疵(6)
问题: 问题出处见 C语言初学者代码中的常见错误与瑕疵(5) . 在该文的最后,曾提到完成的代码还有进一步改进的余地.本文完成了这个改进.所以本文讨论的并不是初学者代码中的常见错误与瑕疵,而是对我自己 ...
- C语言初学者代码中的常见错误与瑕疵(5)
问题: 素数 在世博园某信息通信馆中,游客可利用手机等终端参与互动小游戏,与虚拟人物Kr. Kong 进行猜数比赛. 当屏幕出现一个整数X时,若你能比Kr. Kong更快的发出最接近它的素数答案,你将 ...
- C语言初学者代码中的常见错误与瑕疵(19)
见:C语言初学者代码中的常见错误与瑕疵(19)
- C语言初学者代码中的常见错误与瑕疵(14)
见:C语言初学者代码中的常见错误与瑕疵(14) 相关链接:http://www.anycodex.com/blog/?p=87
- 分数的加减法——C语言初学者代码中的常见错误与瑕疵(12)
前文链接:分数的加减法——C语言初学者代码中的常见错误与瑕疵(11) 重构 题目的修正 我抛弃了原题中“其中a, b, c, d是一个0-9的整数”这样的前提条件,因为这种限制毫无必要.只假设a, b ...
随机推荐
- VMWare虚拟机启动报错物理内存不足
尝试了三种修改 1.说是微软补丁KB2995388冲突-->>失败 2.修改win8.1高级环境性能更改设置-->>失败 3.修改config.ini文件-->>成 ...
- 家用计费系统ER图
家用计费系统研发开始.在此记录自己的开发过程.
- object-c中的BOOL类型
object-c中的布尔类型比C语言中的bool类型早了10年,它具有YES和NO两种值.在object-c中的布尔类型BOOL实际上是一种带符号的字符类型(signed char),它使用的空间是1 ...
- 属性(Attribute)资源
前面已经介绍过自定义View组件的开发,自定义View组件与Android系统提供的View组件一样,即可在Java代码中使用,也可在XML界面布局代码中使用. 当在XML布局文件中使用Android ...
- win7(windows 7)系统下安装SQL2005(SQL Server 2005)图文教程——转载
操作系统:Microsoft Windows 7 旗舰版(32位) 数据库版本:SQL Server 2005 简体中文开发板 数据库下载链接:http://pan.baidu.com/share/l ...
- 网站安全配置(Nginx)防止网站被攻击(包括使用了CDN加速之后的配置方法)
原文链接:http://www.bzfshop.net/article/176.html 网站被攻击是一个永恒不变的话题,网站攻击的方式也是一个永恒不变的老套路.找几百个电脑(肉鸡),控制这些电脑同时 ...
- --@angularJS--独立作用域scope绑定策略之&符策略
1.index.html: <!DOCTYPE HTML><html ng-app="app"><head> <title>s ...
- Java中正则表达式的几种用法
多数内容转载自:http://www.jb51.net/tools/regex.htm ,有改动 用到了java.util.regex包: 1. 验证 Pattern pattern = Patter ...
- H.264 SVC 与H.264 AVC
分级视频编码技术实现一次性编码产生具有不同帧率.分辨率的视频压缩码流,然后根据不同网络带宽.不同的显示屏幕和终端解码能力选择需要传输的视频信息量,以此实现视频质量的自适应调整 AVC 实际上是 H.2 ...
- NSException异常处理
异常处理是管理非典型事件(例如未被识别的消息)的过程,此过程将会中断正常的程序执行.如果没有足够的错误处理,遇到非典型事件时,程序可能立刻抛出(或者引发)一种被称之为异常的东西,然后结束运行. 异常的 ...