ShiftVector template class - 'Symbol(s) not found'
<p>I've created a class that's designed to rotate a vector. (I realize this functionality basically already exists in STL, I'm just trying get a handle on template classes.)</p>

<p>My specification file:</p>

<pre><code>template &lt;class T&gt;
class ShiftVec {
private:
    vector&lt;T&gt; vec;

public:
    ShiftVec(vector&lt;T&gt;);
    vector&lt;T&gt; getVec();
    void shiftRight(int);
    void shiftLeft(int);
};
</code></pre>

<p>My implementation file:</p>

<pre><code>template &lt;class T&gt;
ShiftVec&lt;T&gt;::ShiftVec(vector&lt;T&gt; v) {
    vec = v;
}

template &lt;class T&gt;
vector&lt;T&gt; ShiftVec&lt;T&gt;::getVec() {
    return vec;
}

template &lt;class T&gt;
void ShiftVec&lt;T&gt;::shiftRight(int n) {
    rotate(vec.begin(),
           vec.end()-n, // this will be the new first element

template class ShiftVec&lt;int&gt;;
template class ShiftVec&lt;double&gt;;
template class ShiftVec&lt;bool&gt;;
template class ShiftVec&lt;string&gt;;
</code></pre>

<p>When I run this, I get a bunch of errors that look like this:</p>

<pre><code>Undefined symbols for architecture x86_64:
  "ShiftVec&lt;int&gt;::shiftRight(int)", referenced from:
      _main in main.o
  "ShiftVec&lt;int&gt;::getVec()", referenced from:
      _main in main.o
  "ShiftVec&lt;int&gt;::ShiftVec(std::__1::vector&lt;int, std::__1::allocator&lt;int&gt; &gt;)", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
</code></pre>

<p>I'm not sure exactly what's going wrong here. A push in the right direction would be helpful.</p>