title: C2011: 'struct' type redefinition and C2027: use of undefined type
body: <p>In a file named <code>types.h</code>, I have defined </p>
  
  <pre><code>struct entry {
    entry( int a, int t ) : addr(a), time(t) {}
    int addr;
    int time;
  };
  </code></pre>
  
  <p>In another file I want to use the struct like this in <code>compress.h</code>:</p>
  
  <pre><code>#include "types.h"
  #include &lt;vector&gt;
  class Compress {
  public:
    void insert( int a, int t )
    {
      theVec.clear();
      for (int i = 0; i &lt; 10; ++i) 
         theVec.push_back( entry(a, t) );
    }
  
  private:
    std::vector&lt; entry &gt; theVec;
  };
  </code></pre>
  
  <p>In the main file, I wrote</p>
  
  <pre><code>#include "compress.h"
  int main()
  {
    Compress *com = new Compress;
    com-&gt;insert(10, 100);
    return 0;
  }
  </code></pre>
  
  <p>However at the line of push_back, I get these errors</p>
  
  <pre><code>error C2011: 'entry' : 'struct' type redefinition
  see declaration of 'entry'
  error C2027: use of undefined type 'entry'
  see declaration of 'entry'
  </code></pre>
  
  <p>How can I fix that?</p>