title: How to fix "undefined reference to Array::Array(unsigned long)" in C++?
body: <p>I have a class for sorting a char array. One of the constructors takes the parameter (size_t length). When I pass it a length of type int and try to compile, I get the error</p>
  
  <blockquote>
    <p>driver.cpp:(.text+0x2c): undefined reference to 'Array::Array(unsigned long)'</p>
  </blockquote>
  
  <p>Is there something obvious I am missing? What can I attempt to try to get this code to compile.</p>
  
  <p>I have tried creating a variable of size_t but I get the same error. I have tried changing the parameter to an integer to see if had something to do with it being type size_t, but i get the same error but for int instead.</p>
  
  <blockquote>
    <p>driver.cpp:(.text+0x2c): undefined reference to 'Array::Array(int)'</p>
  </blockquote>
  
  <p>Array.h</p>
  
  <pre><code>class Array{
  public:
  
    Array(size_t length);
  
    ...
    ...
  
  }
  </code></pre>
  
  <p>Array.cpp</p>
  
  <pre><code>Array::Array (size_t length)
  {
      std::cout &lt;&lt; "garbage output" &lt;&lt; std::endl;
  }
  </code></pre>
  
  <p>main.cpp</p>
  
  <pre><code>int main (int argc, char * argv [])
  {
    // TODO Add code here to test your Array class.
  
    Array ar1(10);
  
    return 0;
  }
  </code></pre>
  
  <p>I expect the string "garbage output" but I receive a compilation error.</p>