头文件重复定义的问题。
多个.c文件包含一个.h文件。
.h里面有定义变量。
.h 用了
#ifndef
#define
#endif.
。现在怎么解决重复定义的问题? C
[解决办法]
#ifndef __SAMPLE_H_
#define __SAMPLE_H_
int func(int a);
#endif
#include "sample.h"
int func(int a)
{
return a+1;
}