title: Header file help & structures
body: <p>I have a header file, <code>dimensions.h</code> and in it:</p>
  
  <pre><code>#ifndef DIM_H
  #define DIM_H
  
  typedef struct Dimensions
  {
      int width;
      int height;
  } DIM;
  
  DIM * GetHeader (FILE * fp);
  
  #endif
  </code></pre>
  
  <p>From here I have a c file that does has this:</p>
  
  <pre><code>#include "dimensions.h"
  .
  .
  .
  DIM *  GetHeader (FILE * fp)
  {
      char s[1024];
      struct Dimensions * d = (struct Dimensions *)malloc(sizeof(Dimensions));
  
      if (fgets(s, sizeof(s), fp) != NULL)
      {
          printf("%s", s);
          d-&gt;width = atoi(strtok(s, " \n\0"));
          d-&gt;height = atoi(strtok(NULL, " \n\0"));
      }
  
      return d;
  }
  </code></pre>
  
  <p>But when I run it I get errors like <code>Dimensions undeclared</code>. So I played around with the code changing <code>Dimensions</code> to <code>DIM</code> (still not really understanding the two name 'scheme'.</p>
  
  <pre><code>struct DIM * d = (struct DIM *)malloc(sizeof(DIM));
  </code></pre>
  
  <p>Then I get errors with <code>d-&gt;width</code> and <code>d-&gt;height</code> saying it's dereferencing pointers to incomplete types, so I swapped <code>-&gt;</code> with <code>.</code> and then an error <code>request for member width/height in something not a structure or union</code>.</p>
  
  <p>So not really sure what's going on, might be something really simple that I'm missing so if anyone could help that'd be awesome.</p>
  
  <p>Thanks!</p>