title: incomplete type 'struct' error in C
body: <p>I have this issue and can't see where the error is so I'm hoping someone can help address it. The error I get from compiling the source is:</p>
  
  <pre><code>client.c:15:54: error: invalid application of ‘sizeof’ to incomplete type ‘struct client’
  </code></pre>
  
  <p>I have the struct definition inside a header file - client.h:</p>
  
  <pre><code>#ifndef PW_CLIENT
  #define PW_CLIENT
  
  #include &lt;event2/listener.h&gt;
  #include &lt;event2/bufferevent.h&gt;
  #include &lt;event2/buffer.h&gt;
  
  #include &lt;arpa/inet.h&gt;
  
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;errno.h&gt;
  
  struct client {
      int id;
      struct bufferevent *bev;
  
      struct client *prev;
      struct client *next;
  };
  
  struct client *client_head = NULL;
  
  struct client* client_connect(struct bufferevent *bev);
  #endif
  </code></pre>
  
  <p>And here is the source of client.c:</p>
  
  <pre><code>#include &lt;event2/listener.h&gt;
  #include &lt;event2/bufferevent.h&gt;
  #include &lt;event2/buffer.h&gt;
  
  #include &lt;arpa/inet.h&gt;
  
  #include &lt;stdlib.h&gt;
  #include &lt;stdio.h&gt;
  #include &lt;errno.h&gt;
  
  struct client* client_connect(struct bufferevent *bev) {
      // Client info
      struct client *c = (struct client*)malloc(sizeof(struct client));
      if (c == NULL) {
          // error allocating memory
      } else {
      if (client_head == NULL) {
          // initialize list addresses
          c-&gt;prev = c-&gt;next = NULL;
  
          // set connection id
          c-&gt;id = 0;
      } else {
          // set list addresses
          client_head-&gt;next = c;
          c-&gt;prev = client_head;
          c-&gt;next = NULL;
          client_head = c;
  
          // set connection id
          c-&gt;id = (c-&gt;prev-&gt;id + 1);
      }
  
          // initialize user vars
          c-&gt;bev = bev;
      }
  
      return c;
  }
  </code></pre>
  
  <p>Thanks!</p>