Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
例如,
typedef struct { char * name; component ** components; } object; typedef struct { vector3 pos, orient; object * obj; } component;
我已经按原样进行了尝试,并且可以预见的是,我收到一个错误,即第一个包含指向“组件”指针的指针,编译器尚无法识别该指针。有没有解决的办法?
您需要第二个结构的前向声明以满足第一个中的指针声明:
struct component; // This says there is a struct named component somewhere in the code typedef struct { char * name; struct component ** components; } object; struct component { vector3 pos, orient; object * obj; };