警告:
1.warning: #951-D: return type of function "main" must be "int"
错误示例:
void main()
{
while(1);
}
正确做法:
int main(void)
{
while(1);
}
2.warning: #1-D: last line of file ends without a newline
这是keil的一个bug,只需将在最后一行按下回车,创建新的一行即可,新的一行必须什么也没有,空格也不要出现。
3.warning: #223-D: function "soft_delay" declared implicitly
这是由于写好的函数没有在前面声明导致的,在主函数前面声明一下即可,或者把该函数放在主函数之前.写51的时候也遇到过这种情况。
4.warning: #1295-D: Deprecated declaration KEY_GPIO_Config - give arg types
deprecateddeclaration即不赞成的声明方式,这样的申明是错误的。
这个原因主要是:keil不占成参数是空的,空的的时候必须写明void
"voidtest()"会报warning,而“void test(void)”不会
5.warning:#177-D:variable "a"was declared but never referenced
uint_32 a=50;//原函数
//uint_32 a=50;//改正后
因为我定义了一个变量准备在后面用到,但是后面直接用数字代替了,没有用到,将这个变量注释后,重新编译警告消失。
6.warning: #1295-D: Deprecated declaration IIC_Wait_Ask - give arg types
在声明函数时,如果该函数没有参数就要在括号里加“void”
错误:
1."no source": Error: command-line: #564: cannot open preprocessing output out
这种情况是因为C文件的命名中含有中文字符,换成英文即可。
2.Error: L6200E: Symbol xxx multiply defined (by xxx.o and xxx.o)
出现重定义,在使用了全局变量时有可能出现。我们在两个文件使用中都给变量赋初值,会出现该错误。
改正:在引用此变量的时候取消赋初值即可。
3.Error: L6218E: Undefined symbol Delay (referred from main.o).
翻译一下:错误L6218E未定义符号enet_delay(参考xxxx.o)“ 出现这种情况的原因多半是你使用了未定义或者定义错了的函数。
解决办法:检查一下调用函数的时候函数名称是否正确。