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");
}