常见语法错误集锦

时间:2023-02-10 14:56:32

在编程的过程中经常会犯好多好多的错误,编译器会直接指出错误,可是自己却看不懂,因此专门找了一些资料,供以后参考。

fatal error C1004:unecpected end of file found:未找到文件末尾(可能是括号匹配问题)

fatal error C1021:invalid preprocessor command 'Include':无效的编译预处理命令'Include'
fatal error C1083:cannot open include file:'stdi.h':N such file or directory 不能打开头文件‘stdi.h’,文件或文件夹不存在
error C2101:'&'on constant 不能计算常量的地址
error C2059:syntax error:'while' 在‘while’附近,存在语法错误
error C2061:syntax error :identifier 'x' 标识符x的附近,存在语法错误
fatal error C1004: unexpected end of file found 未找到文件末尾(可能是括号匹配问题) 
 fatal error C1021: invalid preprocessor command '1nclude' 无效的编译预处理命令'1nclude' 
 fatal error C1083: Cannot open include file: 'stdi.h': No such file or directory 不能打开头文件'stdi.h',文件或文件夹不存在   
error C2101: '&' on constant 不能计算常量的地址 
error C2059: syntax error : 'while' 在'while'附近,存在语法错误 
error C2061: syntax error : identifier 'x' 标识符x的附近,存在语法错误 
error C2065: 'i' : undeclared identifier 变量i未定义 
error C2078: too many initializers 数组/结构等变量初始化时的数据太多
error C2087: '<Unknown>' : missing subscript 丢失数组下标  
error C2106: '=' : left operand must be l-value '='的左侧应当是左值,即不能是常量 
error C2115: '=' : incompatible types '='两侧的类型不兼容  
error C2133: 'a' : unknown size a(可能是数组名)的大小不确定。  
error C2137: empty character constant 空的字符常量  
error C2143: syntax error : missing ';' before ...... 在......之前,缺少';'  error C2146: syntax error : missing ')' before identifier '......' 在标识符'......'之前缺少')'  
error C2181: illegal else without matching if else缺少匹配的if 
error C2198: 'printf' : too few actual parameters 'printf'函数的参数太少  
error C2223: left of '->x' must point to struct/union '->x'的左侧应是结构类型变量或联合类型变量 
error C2224: left of '.x' must have struct/union type '.x'的左侧应是结构类型变量或联合类型变量  
error C2371: 'f1' : redefinition; different basic types  函数'f1'的接口被重定义,参数类型或返回值类型不一致   
error LNK2001: unresolved external symbol _f5 f5从未定义
 tob_id_4542
warning C4101: 'x' : unreferenced local variable 'x'是一个从未被使用的局部变量  
warning C4013: 'fi' undefined; assuming extern returning int 函数'fi'未定义,假设其是外部函数,返回值类型是int 

warning C4020: 'fun' : too many actual parameters 调用'fun'函数时,有太多的实参 

warning C4033: 'f3' must return a value 函数'f3'应当有返回值语句  

warning C4047: '=' : 'int *' differs in levels of indirection from 'int ' 赋值运算中的类型转换:从'int '转换到'int *'可能存在问题 

warning C4098: 'f2' : 'void' function returning a value 函数'f2'是无返回值的函数,竟然有返回值语句。 

warning C4133: 'function' : incompatible types - from '...' to '...'  不兼容的类型转换(从'...'类型向'...'类型)  

warning C4244: 'initializing' : conversion from 'const double ' to 'int ', possible loss of data  在初始化数据时,类型转换可能导致数据丢失  

warning C4305: 'initializing' : truncation from 'const int ' to 'char ' 初始化时,数据被截断  

warning C4700: local variable 'x' used without having been initialized 局部变量'x'在被使用之前未初始化,