VS2013 错误对照表(持续更新)

来源:互联网 发布:越贵妃知乎 编辑:程序博客网 时间:2024/06/05 15:12

出错代码

错误详细信息

解决方法

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

(编译错误)常量中包含多个字符

字符型常量的单引号中只能有一个字符,或是以“\”开始的一个转义字符,例如“char error = 'error';”

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 'identifier2'

(编译错误)标识符1不是标识符2的成员

程序错误地调用或引用结构体、共用体、类的成员

error C2041

illegal digit 'x' for base 'n'

(编译错误)对于n进制来说数字x非法

一般是八进制或十六进制数表示错误,例如“int i = 081;”语句中数字‘8’不是八进制的基数

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];”中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

(编译错误)未定义的标识符xxx

1、如果xxx为cout、cin、scanf、printf、sqrt等,则程序中包含头文件有误

2、未定义变量、数组、函数原型等,注意拼写错误或区分大小写。

error C2078

too many initializers

(编译错误)初始值过多

一般是数组初始化时初始值的个数大于数组长度,例如“int b[2]={1,2,3};”

error C2082

redefinition of formal parameter 'xxx'

(编译错误)重复定义形式参数xxx

函数首部中的形式参数不能在函数体中再次被定义

error C2084

function 'xxx' already has a body

(编译错误)已定义函数xxx

相同函数重复定义

error C2086

'xxx' : redefinition

(编译错误)标识符xxx重定义

变量名、数组名重名

error C2087

'<Unknown>' : missing subscript

(编译错误)下标未知

一般是定义二维数组时未指定第二维的长度,例如“int a[3][];”

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[4] = "abcd";”

error C2118

negative subscript or subscript is too large

(编译错误)下标为负或下标太大

一般是定义数组或引用数组元素时下标不正确


1 0
原创粉丝点击