title: C struct, incomplete field type
body: <p>A snippet of my struct declaration:</p>
  
  <pre><code>struct record{
      char type[4];
      uint32_t data_size;
      uint32_t flags;
      uint32_t id;
      uint32_t revision;
      uint16_t version;
      uint16_t unknown;
      uint8_t *data;
  };
  
  struct group;
  
  union subgroup_record{
      int type;
      struct group subgroup;
      struct record record;
  };
  
  struct record_list{
      union subgroup_record subgroup_record;
      struct record_list *next;
  };
  
  struct group{
      char type[4];
      uint32_t group_size;
      uint8_t label[4]; // depends on group_type
      int32_t group_type;
      uint16_t stamp;
      uint16_t unknown1;
      uint16_t version;
      uint16_t unknown2;
      struct record_list record_list;
  };
  
  struct group_list{
      struct group group;
      struct group_list *next;
  };
  
  struct plugin{
      struct record header;
      struct group_list top_groups;
  };
  </code></pre>
  
  <p>The compiler gives me this error:</p>
  
  <pre><code>error: field ‘subgroup’ has incomplete type
  </code></pre>
  
  <p>Forward declaring the struct didn't help, typedef'ing the struct and changing the declarations also didn't help and I'd rather not have pointers everywhere (for a beginner the allocating and freeing memory is a bit scary)</p>
  
  <p>Any solution for this?</p>
  
  <p>Thanks!</p>