Visual C++常见错误信息
VC 编译出错时会指示出程序错误的位置,鼠标双击出错信息行,就可以实现错误的定位。
1、fatal error C1083: Cannot open include file: 'R…….h': No such file
or directory
不能打开包含文件“R…….h”:没有这样的文件或目录。
2、error C2018: unknown character '0xa3'
不认识的字符'0xa3'。(一般是汉字或中文标点符号)
3. fatal error C1004: unexpected end of file found
源文件的‘{’ 与‘}’不匹配。
4、error C2057: expected constant expression
希望是常量表达式。(一般出现在 switch 语句的 case 分支中)
5、error C2065: 'abc' : undeclared identifier
“abc”:标识符没定义,有两种可能,一是未定义;二是在引用时标识符的名字写错了。
6、LINK : fatal error LNK1168: cannot open Debug/P1.exe for
writing
连接错误:不能打开 P1.exe 文件,以改写内容。(一般是 P1.Exe 还在运行,未关闭)
7、warning C4700: local variable 'bReset' used without having been initialized
局部变量“bReset”没有初始化就使用。
8、 C2001: newline in constant
This error is usually caused by a string or character constant that is missing its closing '
or " symbol
9、error C2084: function 'void __cdecl main(void)' already has a body
在一个源文件中定义了两个 main 函数。初学者易犯的错误。一个程序完成后,没有关
闭相应的源文件,接着,在下面又编辑了另一个程序,把两个不相关的程序放在一个源文件
中。
10、error C2143: syntax error: missing ':' before '{'
句法错误:“{”前缺少“;”。
11、error C2146: syntax error : missing ';' before identifier 'dc'
句法错误:在“dc”前丢了“;”。
12、error C2196: case value '69' already used
值 69 已经用过。(一般出现在 switch 语句的 case 分支中)
13、error C2660: 'SetTimer' : function does not take 2 parameters
“SetTimer”函数不传递 2 个参数。
14、warning C4035: 'f……': no return value
函数“f……”的 return 语句没有返回值。
15、引起 LNK2001:unresolved external symbol “srot”。
链接程序不能在所有的库和目标文件内找到所引用的函数、变量或标签。有两种情
况:一是调用了库函数,但没有把它的头文件包含近来;二是调用了用户自己定义的函数
sort,但函数名写成了 srot。
16、error C2082: redefinition of formal parameter 'bReset'
函数参数“bReset”在函数体中重定义。