我有两个模块,a和b。
啊:
#ifndef A_H_
#define A_H_
#include "b.h"
typedef struct {
b_t *b;
...
} a_t;
#endif // A_H_
bh:
#ifndef B_H_
#define B_H_
#include "a.h"
typedef struct {
a_t *a;
...
} b_t;
#endif // B_H_
如何更改它以便可以编译?(我想保留两个单独的编译单元。)
编辑:我忘了使结构成员的指针。
使用前向声明:
啊:
struct b_t;
typedef struct a_t {
struct b_t *b;
} a_t;
bh:
struct a_t;
typedef struct b_t {
struct a_t *a;
} b_t;
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句