title: undefined reference to `readVector(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
body: <p>I got this error message when I tried to compile my code:</p>
  
  <blockquote>
    <p>c++ -Ofast -march=native -DNDEBUG -std=c++11 -Wc++11-extensions -Wall matvec.o amath483.o Vector.o -o matvec </p>
    
    <p>matvec.o: In function <code>main': matvec.cpp:(.text+0x209): undefined reference to</code>readVector(std::__cxx11::basic_string, std::allocator >)' clang: error: linker command failed with exit code 1 (use -v to see invocation) makefile:5: recipe for target 'matvec' failed make: *** [matvec] Error 1</p>
  </blockquote>
  
  <p>My code is as follows:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;cstdlib&gt;
  #include &lt;vector&gt;
  #include &lt;fstream&gt;
  #include "Vector.hpp"
  
  using namespace std;
  
  
  Vector readVector(istream&amp; input) {
      string string_input;
      int n;
      getline(input,string_input);
      if(string_input.compare("AMATH 583 VECTOR") != 0) exit(-1);
      input &gt;&gt; n;
      Vector v(n);
      for(int i = 0; i &lt; n; i++)
          input &gt;&gt; v(i);
      getline(input,string_input);
      getline(input,string_input);
  
      if(string_input.compare("THIS IS THE END") != 0) exit(-1);
  
      return v;
  }
  
  
  Vector readVector(ifstream&amp; file) {
      string string_input;
      int n;
      getline(file,string_input);
      if(string_input.compare("AMATH 583 VECTOR") != 0) exit(-1);
      file &gt;&gt; n;
      Vector v(n);
      for(int i = 0; i &lt; n; i++)
          file &gt;&gt; v(i);
      getline(file,string_input);
      getline(file,string_input);
  
      if(string_input.compare("THIS IS THE END") != 0) exit(-1);
  
      return v;
  }
  
  #include "Vector.hpp"
  #include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include "amath483.hpp"
  
  using namespace std;
  
  int main(int argc, char* argv[]) {
      if(argc &lt; 2 || argc &gt; 4) {
          cout &lt;&lt; "You must provide at least one argument or at most three arguments(including two options)" &lt;&lt; endl;
          return -1;
    }
  
      int inputoption = -1;
      int outputoption = -1;
      if(argc == 3) {
          inputoption = 0;
      }
      if(argc == 4) {
          inputoption = 0;
          outputoption = 0;
      }
  
      // Check the format
      Vector v = NULL;
      if(inputoption == 0) {
          string inputfile = argv[2];
          v = readVector(inputfile);
      } else {
          v = readVector(cin);
      }
  
      for(int i=0; i &lt; v.numRows(); i++)
          cout &lt;&lt; v(i) &lt;&lt; endl;
      return 0;
  }
  </code></pre>