title: C Typedef - Incomplete Type
body: <p>So, out of the blue, the compiler decides to spit this in face:
  "field customer has incomplete type".</p>
  
  <p>Here's the relevant snippets of code:</p>
  
  <h3>customer.c</h3>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  #include "customer.h"
  
  struct CustomerStruct;
  typedef struct CustomerStruct
  {
      char id[8];
      char name[30];
      char surname[30];
      char address[100];
  } Customer ;
  
  /* Functions that deal with this struct here */
  </code></pre>
  
  <h3>customer.h</h3>
  
  <p>A header file for customer.h</p>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  #ifndef CUSTOMER_H
  #define CUSTOMER_H
  
      typedef struct CustomerStruct Customer;
  
      /* Function prototypes here */
  
  #endif
  </code></pre>
  
  <p>This is where my problem is:</p>
  
  <h3>customer_list.c</h3>
  
  <pre><code>#include &lt;stdlib.h&gt;
  #include &lt;string.h&gt;
  
  #include "customer.h"
  #include "customer_list.h"
  
  #include "..\utils\utils.h"
  
  
  struct CustomerNodeStruct;
  typedef struct CustomerNodeStruct
  {
      Customer customer; /* Error Here*/
      struct CustomerNodeStruct *next;
  }CustomerNode;
  
  
  
  struct CustomerListStruct;
  typedef struct CustomerListStruct
  {
      CustomerNode *first;
      CustomerNode *last;
  }CustomerList;
  
  /* Functions that deal with the CustomerList struct here */
  </code></pre>
  
  <p>This source file has a header file, customer_list.h ,but I don't think its relevant.</p>
  
  <h3>My Problem</h3>
  
  <p>In customer_list.c, at the line with the comment <code>/* Error Here */</code>, the compiler complains about <code>field customer has incomplete type.</code></p>
  
  <p>I've been googling this problem all day, and now im at the point of pulling out my eyeballs and blending them with strawberries.</p>
  
  <p>What is the source of this error ?</p>
  
  <p>Thanks in advance :)</p>
  
  <p>[P.S. if I forgot to mention something, let me know. Its been a stressful day for me, as you might tell ]</p>