title: C++ error: "expected constructor, destructor, or type conversion before '<' token
body: <p>I have to build a C++ library for Windows in a Linux environment, using g++. I get this error when I build it:</p>
  
  <pre><code>RWGVector.cpp:5: error: g++ error: "expected constructor, destructor, 
  or type conversion before '&lt;' token
  </code></pre>
  
  <p>Building it in Visual Studio 2010 does not return any error.  I am building this using the C++11 (aka c++0x) standard.</p>
  
  <p>I have two files, one with the template class declaration (RWGVector.h), the other one with the constructor (RWGVector.cpp).  I only kept the essential parts of each file, responsible for the error.</p>
  
  <p>RWGVector.h:</p>
  
  <pre><code>#ifndef _RWGVECTOR_H
  #define _RWGVECTOR_H
  
  #include &lt;vector&gt;
  #include &lt;rw/generic.h&gt;
  
  template&lt;typename V&gt; class RWGVector
  {
      public:
          RWGVector&lt;V&gt;();
  
      private:
          std::vector&lt;V&gt; vector_;
  };
  #endif
  </code></pre>
  
  <p>RWGVector.cpp:</p>
  
  <pre><code>#include "RWGVector.h"
  
  template&lt;typename V&gt;
  RWGVector&lt;V&gt;::RWGVector() : vector_()       //&lt;--- Line 5
  {
  }
  </code></pre>
  
  <p>What causes this error?  How do I fix it?</p>
  
  <p><strong>Solution:</strong></p>
  
  <p>Remove the <code>&lt;V&gt;</code> in <code>RWGVector&lt;V&gt;();</code> as</p>
  
  <blockquote>
    <p><em>In class the constructor need not the claim of template parameter.Because when you specify the class, the parameter has been conformed</em></p>
  </blockquote>
  
  <p>Though I had an other issue, more specific to my situation, because of the &lt; rw/generic.h > file included, which contains the following line:</p>
  
  <pre><code>#define RWGVector(Type) RWTValVector&lt;Type&gt;
  </code></pre>
  
  <p>Commenting that line solved the error.</p>