title: Why can't I use a typedef from a header file which is included in a precompiled header in VC++?
body: <p>So I'm trying to learn some C since I might need it for next semester of college, and I have a little problem in Visual C++ with precompiled headers:</p>
  
  <p>I do something like this in <strong>header1.h:</strong></p>
  
  <pre><code>typedef struct {
      int example;
  } randstruct;
  </code></pre>
  
  <p>Then I do this in <strong>header2.h:</strong></p>
  
  <pre><code>#include "header1.h"
  </code></pre>
  
  <p>Then I do this in <strong>main.c:</strong></p>
  
  <pre><code>#include "header2.h"
  
  int main()
  {
      randstruct *s;
  }
  </code></pre>
  
  <p>Where <strong>header2.h</strong> is the precompiled header. Doing this results in the program not recognizing the struct and giving me errors, claiming that randstruct and s are undeclared identifiers. Doing this outside of the precompiled header (simply in another header) does seem to work, and doing this with function prototypes rather than typedef seems to work as well. What's going on? Is this a VC++ issue or am I misinterpreting something?</p>
  
  <p>PS: I assume someone's going to tell me that this is bad practice or something, and that might be, but that still leaves my curiosity. Also, the standard generated precompiled header in VC++ contains a <strong>#include </strong> and for some reason I can use typedefs like <strong>FILE</strong> normally, despite it being defined in a header file included in the precompiled header which in turn is included in my main c file.</p>