title: Template specification compile error in g++
body: <p>I have a container object that is templatized. I am trying to make a specialized constructor for <code>float</code> versions. Problem is, when the compiler attempts to compile the second object that uses the <code>float</code> version, I get a <code>multiple definition of</code> error.</p>
  
  <p><strong>NOTES:</strong> The entire class in in the <code>h</code> file. The file is wrapped with a definition (<code>#ifndef</code>, <code>#define</code>, and <code>#endif</code>). g++ version 3.4.6. This compiles fine with other compilers, e.g. Intel's icc.</p>
  
  <p>Code is similar to the following:</p>
  
  <pre><code>template &lt;typename T&gt;
  class Container {
  public:
     Container();
     virtual ~Container() {}
  private:
     std::vector&lt;T&gt; data;
     // other members
  };
  
  template &lt;&gt; Container&lt;float&gt;::Container() {
     // do something special
  }
  
  template &lt;typename T&gt; Container&lt;T&gt;::Container() {
     // do default initialization
  }
  </code></pre>
  
  <p>Any ideas? Thanks!</p>
  
  <p><strong>EDIT</strong> The objects being compiled are also going into separate shared objects, not sure if that has something to do with it.</p>