title: Template specialization, multiple defined symbols
body: <p>I know I'm missing something easy here but I've got a templated member function of a class which I've specialised.</p>
  <pre><code>class MyClass
  {
      template&lt;typename T&gt; T GetTFromVariable(shared_ptr&lt;TOtSimpleVariable&gt; v, string s);
  }
  
  template&lt;typename T&gt;
  T MyClass::GetTFromVariable(shared_ptr&lt;TOtSimpleVariable&gt; v, string s)
  {
      throw std::runtime_error(&quot;Don't know how to convert &quot; + ToString(v-&gt;GetString()));
  }
  
  template&lt;&gt;
  int MyClass::GetTFromVariable&lt;int&gt;(shared_ptr&lt;TOtSimpleVariable&gt; v, string s)
  {
      return v-&gt;GetInteger();
  }
  
  template&lt;&gt;
  string MyClass::GetTFromVariable&lt;string&gt;(shared_ptr&lt;TOtSimpleVariable&gt; v, string s)
  {
      return v-&gt;GetString();
  }
  
  // etc for other specialisations.
  </code></pre>
  <p>This is defined in my header file (as templates should be) but when I go to compile, I get a bunch of multiple defined symbols errors, such as:</p>
  <pre><code>OtCustomZenith_logic.lib(PtPathOutput.obj) : error LNK2005: &quot;public: class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; __thiscall MyClass::GetTFromVariable&lt;class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt; &gt;(class boost::shared_ptr&lt;class TOtSimpleVariable&gt;,class std::basic_string&lt;char,struct std::char_traits&lt;char&gt;,class std::allocator&lt;char&gt; &gt;)&quot; (??$GetTFromVariable@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@CommandProperties@@QAE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$shared_ptr@VTOtSimpleVariable@@@boost@@V12@@Z) already defined in TableFareSystem_test.obj
  </code></pre>
  <p>I can fix it by inlining the method but I don't think that should be necessary... what am I missing?</p>
  <p>EDIT: I'm using Visual Studio 2010</p>