title: C++: Constructor/destructor unresolved when not inline?
body: <p>In a plugin-based C++ project, I have a <code>TmpClass</code> that is used to exchange data between the main application and the plugins. Therefore the respective <code>TmpClass.h</code> is included in the abstract plugin interface class that is included by the main application project, and implemented by each plugin.</p>
  
  <p>As the plugins work on STL vectors of <code>TmpClass</code> instances, there needs to be a default constructor and destructor for the <code>TmpClass</code>. I had declared these in <code>TmpClass.h</code>:</p>
  
  <pre><code>class TmpClass {
    TmpClass();
    ~TmpClass();
  }
  </code></pre>
  
  <p>and implemented them in <code>TmpClass.cpp</code>.</p>
  
  <pre><code>TmpClass::~TmpClass() {}
  TmpClass::TmpClass() {}
  </code></pre>
  
  <p>However, when compiling plugins this leads to the linker complaining about two unresolved externals - the default constructor and destructor of <code>TmpClass</code> as required by the <code>std::vector&lt;TmpClass&gt;</code> template instantiation - even though all other functions I declare in <code>TmpClass.h</code> and implement in <code>TmpClass.cpp</code> work. As soon as I remove the (empty) default constructor and destructor from the .cpp file and inline them into the class declaration in the .h file, the plugins compile and work.</p>
  
  <p>Why is it that the default constructor and destructor <strong>have</strong> to be inline for this code to compile? Why does it even maatter? (I'm using MSVC++8).</p>