求教大神:C语言(Keil μVision)里为什么定义头文件程序就会错误
打个比方:
存在如下文件:
---------文件名delay_api.c-----------------
#include<delay_api.h>
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
#define nMHZ 12 //晶振频率
void msdelay(uint i){
uint x,j,clk;
clk=nMHZ*12;
for(j=0;j<i;j++)
for(x=0;x<=clk;x++);
}
void macdelay(uint i){
uint j;
for(j=0;j<i;j++);
}
#ifndef DELAY_API_H
#define DELAY_API_H
extern void macdelay(unsigned int i);
extern void msdelay(unsigned int i);
#endif
#ifndef _DELAY_API_C
#define _DELAY_API_C
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
#define nMHZ 12 //晶振频率
void msdelay(uint i){
uint x,j,clk;
clk=nMHZ*12;
for(j=0;j<i;j++)
for(x=0;x<=clk;x++);
}
void macdelay(uint i){
uint j;
for(j=0;j<i;j++);
}
#endif