title: C++ previous definition error
body: <p>So, thanks to this website, I found the answer to my previous problem. I'm adding a function to a class in a GNU automake project that uses a pointer to a <code>doc</code> object. Dependencies were included in the Makefile.am file to include <code>doc.h</code> and <code>plsa.h</code> in the respective order. However, when I compiled, I would get a <code>doc has not been declared</code> error. Then, I tried adding the #include statement here, which gives a <code>previous redefinition of 'class doc'</code> error.</p>
  
  <p>I learned that I have to declare <code>doc</code> by using the <code>class doc;</code> line commented out below; however, I thought that this was only necessary if I was declaring a function that passes the object by value. Can someone explain to me why the #include is incorrect in this case?</p>
  
  <pre><code>#include "doc.h"
  //class doc;
  class plsa {
      // ...
      int infer(doc *trset, int maxiter, double noiseH);
  }
  </code></pre>