title: Having an error in c++; Unimplemented constructors?
body: <p>I'm new to programming and I'm trying to implement a simple version of an ArrayList. I'm getting an error, and when I tried to find a solution, people said it was because a constructor was declared but not implemented. I implemented all the constructors I declared in the header, so I'm not sure what's wrong. Some advice appreciated! </p>
  
  <blockquote>
    <p>Error 1   error LNK2019: unresolved external symbol "public: __thiscall
    ArrayList::ArrayList(void)" (??0?$ArrayList@H@@QAE@XZ)
    referenced in function _main</p>
    
    <p>Error 2   error LNK2019: unresolved external symbol "public: void
    __thiscall ArrayList::add(int)" (?add@?$ArrayList@H@@QAEXH@Z) referenced in function _main   </p>
    
    <p>Error 3   error LNK1120: 2 unresolved externals</p>
  </blockquote>
  
  <p>ArrayList.h</p>
  
  <pre><code>#pragma once
  #ifndef ArrayList_h
  #define ArrayList_h
  #include &lt;stdexcept&gt;
  using namespace std;
  
  template &lt;class T&gt;
  class ArrayList
  {
  public:
      ArrayList();
      ~ArrayList();
      void add(T item);
      void expandArray();
      T get(int index);
  
  private:
      int size;
      int length;
      T* list;
  };
  
  #endif
  
  //ArrayList.cpp
  #include "ArrayList.h"
  
  template &lt;class T&gt;
  ArrayList&lt;T&gt;::ArrayList(){
      size=1;
      length=0;
      list = new T(size);
      for(int x=0; x&lt;size;x++){
          list[x]=NULL;
      }
  
  }
  
  template &lt;class T&gt;
  ArrayList&lt;T&gt;::~ArrayList(){
      delete[] list;
  }
  
  
  template &lt;class T&gt;
  void ArrayList&lt;T&gt;::add(T item){
      if(length&gt;=size){
          expandArray();
      }
      list[length]=item;
      length++;
  }
  
  template &lt;class T&gt;
  void ArrayList&lt;T&gt;::expandArray(){
      size*=2;
      T* temp = new T(size);
      for(int x=0;x&lt;size;x++){
          temp[x]=NULL;
      }
      for(int x=0;x&lt;length;x++){
          temp[x]=list[x];
      }
      delete[] list;
      list=temp;
  }
  
  template &lt;class T&gt;
  T ArrayList&lt;T&gt;::get(int index){
      if(index&gt;length||index&lt;0){
          throw out_of_range("Index out of bounds!");
      }
      return list[index];
  }
  </code></pre>
  
  <p>Main.cpp</p>
  
  <pre><code>#include "ArrayList.h"
  
  
  int main(){
  
      ArrayList&lt;int&gt;* list = new ArrayList&lt;int&gt;();
  
      for(int x=0; x&lt;=30;x++){
          list-&gt;add(x);
      }
  
      return 0;
  }
  </code></pre>