在 2 个文件 .c 中包含相同的 header
include same header in 2 files .c
c 文件:Primitives.c、bloc.c 和 main.c
和 2.h headers: bloc.h 和 primitives.h
我想研究 Primitives.c 并使用我在 primitives.c 中制作的 #include "primitives.h"
函数 bloc.c
在 primitives.h 我有 :
#ifndef PRIMITIVES_H_
#define PRIMITIVES_H_
#include "bloc.h"
#endif
在bloc.h中:
#ifndef BLOC_H_
#define BLOC_H_
...
#endif
在primitives.c中:
#include "primitives.h"
printf ("%d", var);
终于在 bloc.c 中:我推杆
int var =2;
问题是我编译的时候显示的是primitives.c:
primitives.c:5:9: 错误:预期的声明说明符或字符串常量前的“...”(法语,抱歉)
你不能输入行:printf("%d", var);
下面包括。它必须放在函数中。
c 文件:Primitives.c、bloc.c 和 main.c
和 2.h headers: bloc.h 和 primitives.h
我想研究 Primitives.c 并使用我在 primitives.c 中制作的 #include "primitives.h"
函数 bloc.c
在 primitives.h 我有 :
#ifndef PRIMITIVES_H_
#define PRIMITIVES_H_
#include "bloc.h"
#endif
在bloc.h中:
#ifndef BLOC_H_
#define BLOC_H_
...
#endif
在primitives.c中:
#include "primitives.h"
printf ("%d", var);
终于在 bloc.c 中:我推杆 int var =2;
问题是我编译的时候显示的是primitives.c: primitives.c:5:9: 错误:预期的声明说明符或字符串常量前的“...”(法语,抱歉)
你不能输入行:printf("%d", var); 下面包括。它必须放在函数中。