title: Undefined Reference Compiler Error
body: <p>I think I'm getting close, but I'm having this error I've been banging my head against the wall on for hours. I'm missing something stupid, and I've gone character by character but I can't find it. </p>
  
  <p>The compiler is giving me </p>
  
  <pre><code>main.cpp:16: undefined reference to `translator::translator(std::istream&amp;)'
  collect2: error: ld returned 1 exit status
  </code></pre>
  
  <p>when I try to compile my program. The command I'm using to compile is: </p>
  
  <pre><code>clear &amp;&amp; g++ -g -Wall main.cpp -o Pear
  </code></pre>
  
  <p>The three sections of use are as follows:</p>
  
  <p>main.cpp</p>
  
  <pre><code>int main(int argc, char* argv[])
  {
  
  std::ifstream myFile;
  
  myFile.open(argv[1]);
  
  translator example(myFile); 
  
  myFile.close(); 
  
  return 0; 
  }
  </code></pre>
  
  <p>translator.cpp</p>
  
  <pre><code>#include &lt;fstream&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  #include "translator.h"
  
  
  translator::translator(std::istream&amp; in)
  {   
  table1(in);
  table2(in);
  }
  </code></pre>
  
  <p>translator.h</p>
  
  <pre><code>#ifndef TRANSLATOR
  #define TRANSLATOR
  
  #include &lt;fstream&gt;
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  
  #include "translationTable.h"
  
  
  class translator
  {
  private:
  
  translationTable&lt;std::string, int&gt; table1;
  
  translationTable&lt;int, std::string&gt; table2;
  
  translator(); 
  
  public:
  
  translator(std::istream&amp; in); 
  
  };
  
  
  
  #endif
  </code></pre>
  
  <p>Any ideas? I've tried so much, and I've looked up similar problems, but they all have different sources. Thanks in advance!</p>