您可以使用指向它的指针,
othersrc.c而不必包括它:
othersrc.c:
struct foo{ struct test_st *p;};但是否则,您需要以某种方式包括结构定义。一个好的方法是在main.h中定义它,并将其包含在两个.c文件中。
main.h:
struct test_st{ int state; int status;};main.c:
#include "main.h"
othersrc.c:
#include "main.h"
当然,您可能会找到比main.h更好的名称。



