title: Visual C++ template syntax errors
body: <p>I have a header file...</p>
  
  <pre><code>#include &lt;SFML\Graphics.hpp&gt;
  #include &lt;SFML\Graphics\Drawable.hpp&gt;
  #include &lt;SFML\System.hpp&gt;
  #include &lt;iostream&gt;
  
  #ifndef _SPRITE_H_
  #define _SPRITE_H_
  
  namespace Engine 
  {
      template &lt;class T&gt;
      class Sprite
      {
          sf::Vector2&lt;T&gt; * vector;
          sf::Sprite * sprite;
  
      public:
          Sprite(sf::Vector2&lt;T&gt; vect, sf::Sprite spr) 
          { 
              this-&gt;sprite = spr;
              this-&gt;vector = vect;            
          }
          ~Sprite();
          bool Draw(T x, T y, T rotate = 0);
          sf::Image GetImage()
          {
              return this-&gt;sprite-&gt;GetImage();
          }
      };
  };
  
  #endif _SPRITE_H_
  </code></pre>
  
  <p>And a source file...</p>
  
  <pre><code>#include &lt;SFML/Graphics.hpp&gt;
  #include &lt;SFML/Config.hpp&gt;
  
  #include "sprite.h"
  
  template &lt;typename T&gt;
  Sprite(sf::Vector2&lt;T&gt; vector, sf::Sprite sprite) 
  {
      this-&gt;sprite = sprite;
      this-&gt;vector = vector;
  }
  
  template &lt;typename T&gt;
  bool Draw(T x, T y, T rotate) 
  {
      return false;
  }
  </code></pre>
  
  <p>In VS 2010, when I compile VC++ I get the following errors:</p>
  
  <pre><code>Error   2   error C2143: syntax error : missing ';' before '&lt;'  c:\users\owner\documents\visual studio 2010\projects\engine2\engine2\sprite.cpp 7   1   Engine2
  Error   3   error C4430: missing type specifier - int assumed. Note: C++ does not support default-int   c:\users\owner\documents\visual studio 2010\projects\engine2\engine2\sprite.cpp 7   1   Engine2
  Error   4   error C2988: unrecognizable template declaration/definition c:\users\owner\documents\visual studio 2010\projects\engine2\engine2\sprite.cpp 7   1   Engine2
  Error   5   error C2059: syntax error : '&lt;' c:\users\owner\documents\visual studio 2010\projects\engine2\engine2\sprite.cpp 7   1   Engine2
  Error   6   error C2059: syntax error : ')' c:\users\owner\documents\visual studio 2010\projects\engine2\engine2\sprite.cpp 7   1   Engine2
  Error   7   error C2143: syntax error : missing ';' before '{'  c:\users\owner\documents\visual studio 2010\projects\engine2\engine2\sprite.cpp 15  1   Engine2
  Error   8   error C2447: '{' : missing function header (old-style formal list?) c:\users\owner\documents\visual studio 2010\projects\engine2\engine2\sprite.cpp 15  1   Engine2
  </code></pre>
  
  <p>I am a total noob to C++ (coming from C#), and have been having issues compiling this simple file as a means to at least learn the syntax before I continue on. As you can see, all I'm trying to do is reference a template from a header file to a source file, so that template reference effects all of my methods.</p>
  
  <p>What am I doing wrong? I've tried to understand these compiler messages, but I'm having trouble decrypting them.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Followed suggestion: took care of almost everything, except for this:</p>
  
  <pre><code>Error   1   error C2995: 'Engine::Sprite&lt;T&gt;::Sprite(sf::Vector2&lt;T&gt;,sf::Sprite)' : function template has already been defined    c:\users\owner\documents\visual studio 2010\projects\engine2\engine2\sprite.cpp 12  1   Engine2
  </code></pre>