C Typedef - Incomplete Type

后端 未结 4 1196
醉梦人生
醉梦人生 2020-12-03 09:00

So, out of the blue, the compiler decides to spit this in face: \"field customer has incomplete type\".

Here\'s the relevant snippets of code:

customer.c

4条回答
  •  情歌与酒
    2020-12-03 09:26

    It seems that something like

    typedef struct foo bar;
    

    won't work without the definition in the header. But something like

    typedef struct foo *baz;
    

    will work, as long as you don't need to use baz->xxx in the header.

提交回复
热议问题