title: Splitting a C++ class into files now won't compile
body: <p>I am teaching myself to write classes in C++ but can't seem to get the compilation to go through. If you can help me figure out not just how, but why, it would be greatly appreciated. Thank you in advance! Here are my three files:</p>
  
  <p><strong>make_pmt.C</strong></p>
  
  <pre><code>#include &lt;iostream&gt;
  #include "pmt.h"
  
  using namespace std;
  
  
  int main() {
      CPMT *pmt = new CPMT;
      pmt-&gt;SetVoltage(900);
      pmt-&gt;SetGain(2e6);
  
      double voltage = pmt-&gt;GetVoltage();
      double gain= pmt-&gt;GetGain();
  
      cout &lt;&lt; "The voltage is " &lt;&lt; voltage
           &lt;&lt; " and the gain is " &lt;&lt; gain &lt;&lt; "." &lt;&lt;endl;
  
      return 0;
  }
  </code></pre>
  
  <p><strong>pmt.C</strong></p>
  
  <pre><code>#include "pmt.h"
  
  using namespace std;
  
  class CPMT {
      double gain, voltage;
      public:
          double GetGain() {return gain;}
          double GetVoltage() {return voltage;}
  
          void SetGain(double g) {gain=g;}
          void SetVoltage(double v) {voltage=v;}
  };
  </code></pre>
  
  <p><strong>pmt.h</strong></p>
  
  <pre><code>#ifndef PMT_H
  #define PMT_H 1
  
  using namespace std;
  
  class CPMT {
      double gain, voltage;
      public:
          double GetGain();
          double GetVoltage();
  
          void SetGain(double g);
          void SetVoltage(double v);
  };
  
  #endif
  </code></pre>
  
  <p>And for reference, I get a linker error (right?):</p>
  
  <pre><code>Undefined symbols:
    "CPMT::GetVoltage()", referenced from:
        _main in ccoYuMbH.o
    "CPMT::GetGain()", referenced from:
        _main in ccoYuMbH.o
    "CPMT::SetVoltage(double)", referenced from:
        _main in ccoYuMbH.o
    "CPMT::SetGain(double)", referenced from:
        _main in ccoYuMbH.o
  ld: symbol(s) not found
  collect2: ld returned 1 exit status
  </code></pre>