|
楼主 |
发表于 2023-7-14 21:47:13
|
显示全部楼层
math.c(30): warning C35: 'delay_ms': uses old-style declarator,KEIL编译不通过,我把delay函数移植到库函数中的,貌似哪里出了问题。
void delay_ms(u16 ms)
{
u16 i;
do{
i = MAIN_Fosc / 6000;
while(--i); //6T per loop
}
while(--ms);
}
这是.C文件
#ifndef __MATH_H
#define __MATH_H
#define MAIN_Fosc 24000000L //定义主时钟
int Add(int parm1,int parm2);//加法运算
int Sub(int parm1,int parm2);//减法运算
int Mul(int parm1,int parm2);//乘法运算
int Div(int parm1,int parm2);//除法运算
void delay_ms(u16 ms);
#endif
这是.h文件,求指导为啥编译不通过,各种报错提醒。
math.h(10): error C25: syntax error near 'ms'
math.c(29): error C25: syntax error near 'ms'
math.c(30): warning C35: 'delay_ms': uses old-style declarator
math.c(31): error C25: syntax error near 'i'
math.c(31): warning C34: 'i': missing declaration specifiers
math.c(32): error C25: syntax error near 'do'
math.c(33): error C53: redefinition of 'i'
math.c(34): error C25: syntax error near 'while'
math.c(34): error C25: syntax error near '--'
math.c(34): error C25: syntax error near ')'
math.c(36): error C25: syntax error near '--'
math.c(36): error C25: syntax error near ')' |
|