title: How to use struct declare
body: <p>I want to hide the struct define, so I define struct in the source file, like this :</p>
  <pre><code>//a.c
  #include &quot;a.h&quot;
  
  struct a_s
  {
     int a;
     int b;
  };
  
  int func(a_t *a)
  {
     printf(&quot;%d\n&quot;, a-&gt;a);
     return 0;
  }
  
  
  </code></pre>
  <p>and I declare the struct in the header file, like this:</p>
  <pre><code>//a.h
  #ifndef TEST
  #define TEST
  #include &lt;stdio.h&gt;
  #include &lt;stddef.h&gt;
  
  typedef struct a_s a_t;
  #endif
  </code></pre>
  <p>Then I use the struct <code>a_t</code> int main.c file, like this:</p>
  <pre><code>#include &quot;stddef.h&quot;
  #include &quot;a.h&quot;
  
  int main()
  {
     a_t a;
     a.a =2;
     func(&amp;a);
  
     return 0;
  
  }
  
  </code></pre>
  <p>But when I compile the main.c by <code>gcc -c main.c</code>, it failed by</p>
  <pre><code>main.c: In function ‘main’:
  main.c:7:15: error: storage size of ‘a’ isn’t known
      struct a_s a;
  
  </code></pre>
  <p>Why is this failing?</p>