title: I'm getting "undefined reference" errors for a bunch of my functions and I can't figure out why
body: <p>Every single function in my class is giving me this error. I'll throw in my 3 parameter constructor as an example:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  using namespace std;
  
  class Mixed{
      public:
          Mixed(int i, int n, int d);    
      private:
          int integer, numerator, denominator;
  };
  </code></pre>
  
  <p>and my cpp:</p>
  
  <pre><code>#include "mixed.h"
  #include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  
  using namespace std;
  
  Mixed::Mixed(int i, int n, int d){
      int valid;
      int negatives = 0;
  
      if (d == 0){
          valid = 0;
      }
      if (d &lt; 0 | n &lt; 0 | i &lt; 0 &amp;&amp; valid != 0){ //if there are any negatives and it hasn't been made invalid
          if (i &lt; 0){ //start counting negatives
              negatives++;
          }
          if (n &lt; 0){
              negatives++;
          }
          if (d &lt; 0){
              negatives++;
          }
          if (negatives &gt; 1){ //invalid if more than one negative value
              valid = 0;
          }
          else {
              valid = 1;
          }
  
          if (i != 0 &amp;&amp; valid != 0){ //check for order if it hasn't already been made invalid
              if (n &lt; 0 | d &lt; 0){ //invalid if integer is non zero, but one of the others is negative
                  valid = 0;
              }
          }
          else if (n != 0 &amp;&amp; d &lt; 0){ //invalid if integer is zero, numerator is nonzero, and denominator is negative
              valid = 0;
          }
          else if (valid != 0){ //if it hasn't already been invalidated, it's valid
              valid = 1;
          }
      }
  
      if (valid == 0){
          this -&gt; integer = 0;
          this -&gt; numerator = 0;
          this -&gt; denominator = 0;
      }
      else{
          this -&gt; integer = i;
          this -&gt; numerator = n;
          this -&gt; denominator = d;
      }
  }
  </code></pre>
  
  <p>the main.cpp where my class is being used does contain </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "mixed.h"
  using namespace std;
  </code></pre>
  
  <p>My errors look like: </p>
  
  <p>/tmp/ccbdj59O.o: In function <code>main': main.cpp:(.text+0x34): undefined reference to</code>Mixed::Mixed(int, int, int)'</p>
  
  <p>I'm at my wit's end and it feels like it's an obvious mistake. Thoughts?   </p>