title: undefined C struct forward declaration
body: <p>I have a header file port.h, port.c, and my main.c</p>
  
  <p>I get the following error: 'ports' uses undefined struct 'port_t'</p>
  
  <p>I thought as I have declared the struct in my .h file and having the actual structure in the .c file was ok.</p>
  
  <p>I need to have the forward declaration as I want to hide some data in my port.c file.</p>
  
  <p>In my port.h I have the following:</p>
  
  <pre><code>/* port.h */
  struct port_t;
  </code></pre>
  
  <p>port.c:</p>
  
  <pre><code>/* port.c */
  #include "port.h"
  struct port_t
  {
      unsigned int port_id;
      char name;
  };
  </code></pre>
  
  <p>main.c:</p>
  
  <pre><code>/* main.c */
  #include &lt;stdio.h&gt;
  #include "port.h"
  
  int main(void)
  {
  struct port_t ports;
  
  return 0;
  }
  </code></pre>
  
  <p>Many thanks for any suggestions,</p>