title: How to fix undefined reference to in my case?
body: <p>I compile the code like so: c++ .\Run.cpp .\Vector.cpp
  The Vector.cpp and the Vector.h are in the same folder..
  I've seen many threads about this problem, but they didn't help, im sure that there is a miniature problem but i can't see it... Thank you for the help!</p>
  
  <p>This is the Vector.h</p>
  
  <pre><code>#ifndef VECTOR_H
  #define VECTOR_H
  #include &lt;iostream&gt;
  
  template &lt;class T&gt;
  class Vector
  {
  private:
      T *data;
      size_t size;
  
  public:
      Vector() : data(nullptr), size(0) {}
      Vector(const Vector&lt;T&gt; &amp;v);
      ~Vector();
      Vector&lt;T&gt; &amp;operator=(const Vector&lt;T&gt; &amp;v);
  
      void push_back(T el);
      void push_front(T el);
      void erase(size_t i);
      void clear();
  
      bool contains(T el);
      T &amp;operator[](size_t i);
      size_t length();
  };
  
  template &lt;class T&gt;
  std::ostream &amp;operator&lt;&lt;(std::ostream &amp;os, const Vector&lt;T&gt; &amp;v);
  
  #endif
  </code></pre>
  
  <p>This is the Vector.cpp</p>
  
  <pre><code>#include "Vector.h"
  #include &lt;iostream&gt;
  
  template&lt;class T&gt;
  size_t Vector&lt;T&gt;::length(){
      return size;
  }
  
  template&lt;class T&gt;
  T &amp;Vector&lt;T&gt;::operator[] (size_t i){
      return data[i];
  }
  
  template&lt;class T&gt;
  Vector&lt;T&gt;::Vector(const Vector&amp; v) {
      data = new T[v.size()];
      for (size_t i = 0; i &lt; v.size; i++)
      {
          data[i] = v[i];
      }
      size = v.size();
  }
  
  template&lt;class T&gt;
  Vector&lt;T&gt; &amp;Vector&lt;T&gt;::operator= (const Vector&amp; v){
      if(this != &amp;v){
          delete data;
          data = new T[v.size];
          for (size_t i = 0; i &lt; v.size; i++)
          {
              data[i] = v[i];
          }
          size = v.size();
      }
      return *this;
  }
  
  template&lt;class T&gt;
  Vector&lt;T&gt;::~Vector(){
      delete data;
  }
  
  template&lt;class T&gt;
  void Vector&lt;T&gt;::push_back(T el){
      T* newData = new T[size+1];
      for (size_t i = 0; i &lt; size; i++)
      {
          newData[i] = data[i];
      }
      newData[size] = el;
      size++;
      delete data;
      data = newData;
  }
  
  template&lt;class T&gt;
  void Vector&lt;T&gt;::push_front(T el){
      T* newData = new T[size+1];
      for (size_t i = 0; i &lt; size; i++)
      {
          newData[i+1] = data[i];
      }
      newData[0] = el;
      size++;
      delete data;
      data = newData;
  }
  
  template&lt;class T&gt;
  void Vector&lt;T&gt;::erase(size_t _i){
      T* newData = new T[size-1];
      for (size_t i = 0, j = 0; i &lt; size; i++, j++)
      {
          if(i == _i){
              i--;
              continue;
          }
          newData[i] == data[j];
      }
      --size;
      delete data;
      data = newData;
  }
  </code></pre>
  
  <p>The run.cpp</p>
  
  <pre><code>#include "Vector.h"
  #include &lt;iostream&gt;
  using namespace std;
  
  int main(){
      Vector&lt;int&gt; v;
      v.push_back(4);
      cout &lt;&lt; v &lt;&lt; endl;
      return 0;
  }
  </code></pre>
  
  <p>The errors: 
  undefined reference to <code>Vector&lt;int&gt;::push_back(int)</code>,
  undefined reference to <code>std::ostream&amp; operator&lt;&lt; &lt;int&gt;(std::ostream&amp;, Vector&lt;int&gt; const&amp;)</code>, undefined reference to <code>Vector&lt;int&gt;::~Vector()</code>, undefined reference to `Vector::~Vector()'</p>