title: extern struct array error: array type has incomplete element type
body: <p>I have 3 files: <code>main.c</code>, <code>def.c</code>, <code>def.h</code>. Both <code>.c</code> files include <code>def.h</code>. 
  All the files are in the same directory.
  My compiler is <strong>gcc version 4.9.2</strong>.</p>
  
  <p>In <strong>def.h</strong>:</p>
  
  <pre><code>struct _info {
      int a;
  };
  </code></pre>
  
  <p>In <strong>def.c</strong>:</p>
  
  <pre><code>#include "def.h"
  struct _info info[] = {};
  </code></pre>
  
  <p>And in <strong>main.c</strong>:</p>
  
  <pre><code>#include "def.h"
  extern struct _info info[];
  </code></pre>
  
  <p>When I build <code>def.c</code> as an object file and then build with <code>main.c</code> like:</p>
  
  <pre><code>gcc -c def.c
  gcc main.c def.o
  </code></pre>
  
  <p>And I got an error message: <strong>array type has incomplete element type</strong></p>
  
  <hr>
  
  <p>If I use <code>typedef</code> to define <code>struct _info</code> as <code>INFO</code> like:</p>
  
  <pre><code>typedef struct _info INFO;
  </code></pre>
  
  <p>And replace <code>struct _info</code> with <code>INFO</code> in <code>.c</code> files.
  Compile ok then.</p>
  
  <p>But <strong>why</strong> and <strong>what</strong> does <code>typedef</code> do?</p>