How do I compile the following program?
<p>I'm learning linear algebra, and thought I'd transform some of my new found knowledge into a small C++ program. For the numbers, I stumbled across <a href="http://www.ginac.de/CLN/cln.html#SEC_Top" rel="nofollow">CLN, a Class Library for Numbers</a>, which I'm trying to use. </p>

<p>LinearEquation.h:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;cln/real.h&gt;
#include &lt;cln/rational.h&gt;
using namespace std;
using namespace cln;

class LinearEquation{
public:
  // constructor
  LinearEquation(cl_R* coefficients, int numFactors, cl_R constant);

  // copy constructor
  LinearEquation(const LinearEquation&amp; le);

  // assignment constructor
  LinearEquation&amp; operator=(const LinearEquation&amp; rhs);

  // destructor
  ~LinearEquation();

  /*
    isSolution returns true if a provided set of rational numbers is a solution
    to this linear Equation, and false otherwise.

    No error checking is done, thus s and num is expected to match the number 
    of items in _coefficients;
  */
  bool isSolution(const cl_R* s, int num);

private:
  int _numFactors;
  cl_R* _coefficients;
  cl_R _constant;
};
</code></pre>

<p>LinearEquation.cpp:</p>

<pre><code>#include "LinearEquation.h"

// constructor
LinearEquation::LinearEquation(cl_R* coefficients,
                   int numFactors,
                   cl_R constant){
  _numFactors = numFactors;
  _coefficients = new cl_R[numFactors];
  for(int i=0; i&lt;numFactors; i++){
    _coefficients[i] = coefficients[i];
  }
  _constant = constant;
}

// copy constructor
LinearEquation::LinearEquation(const LinearEquation&amp; obj){
  _numFactors = obj._numFactors;
  _coefficients = new cl_R[_numFactors];
  for(int i=0; i&lt;_numFactors; i++){
    _coefficients[i] = obj._coefficients[i];
  }
  _constant = obj._constant;
}

// assignment constructor
LinearEquation&amp; LinearEquation::operator=(const LinearEquation&amp; le){
  if(this != &amp;le){
    _numFactors = le._numFactors;
    delete [] _coefficients;
    _coefficients = new cl_R[_numFactors];
    for(int i=0; i&lt;_numFactors; i++){
      _coefficients[i] = le._coefficients[i];
    }
    _constant = le._constant;
  }
}

// destructor
LinearEquation::~LinearEquation(){
  delete [] _coefficients;
}

bool LinearEquation::isSolution(const cl_R* s, int num){
  cl_R sum = 0;
  for(int i=0; i&lt;_numFactors; i++){
    sum = sum + (_coefficients[i] * s[i]);
  }
  return sum == _constant;
}
</code></pre>

<p>and finally, main.cpp</p>

<pre><code>#include &lt;cln/integer.h&gt;
#include &lt;cln/real.h&gt;
#include "LinearEquation.h"
#include &lt;iostream&gt;
using namespace cln;
using namespace std;

int main(){
  int le1NumFactors = 2;
  cl_R* le1Coefficients = new cl_R[le1NumFactors];
  le1Coefficients[0] = 3;
  le1Coefficients[1] = 2;
  cl_R le1Constant = 7;
  LinearEquation le1(le1Coefficients, le1NumFactors, le1Constant);

  int le2NumFactors = 2;
  cl_R* le2Coefficients = new cl_R[le2NumFactors];
  le2Coefficients[0] = -1;
  le2Coefficients[1] = 1;
  cl_R le2Constant = 6;
  LinearEquation le2(le2Coefficients, le2NumFactors, le2Constant);

  cl_R* solution = new cl_R[le2NumFactors];
  solution[0] = -1;
  solution[1] = 5;

  cout &lt;&lt; "(-1, 5) is " &lt;&lt; (le1.isSolution(solution, 2) ? "" : "not ")
       &lt;&lt; "a solution to le1." &lt;&lt; endl;
  cout &lt;&lt; "(-1, 5) is " &lt;&lt; (le2.isSolution(solution, 2) ? "" : "not ")
       &lt;&lt; "a solution to le2." &lt;&lt; endl;

  delete [] le1Coefficients;
  delete [] le2Coefficients;
  delete [] solution;

  return 0;
}
</code></pre>

<blockquote>
  <p>g++ LinearEquation.h LinearEquation.cpp -c</p>
</blockquote>

<p>works fine, but </p>

<blockquote>
  <p>g++ main.cpp LinearEquation.o </p>
</blockquote>

<p>doesn't. The following error message is produced:</p>

<blockquote>
  <p>lowerkey@cassiopeia:~/Desktop/math$ g++ main.cpp LinearEquation.o
  /tmp/ccMceM9l.o: In function
  <code>__static_initialization_and_destruction_0(int, int)':
  main.cpp:(.text+0x4ab): undefined reference to
  </code>cln::cl_random_def_init_helper::cl_random_def_init_helper()'
  main.cpp:(.text+0x4b0): undefined reference to
  <code>cln::cl_random_def_init_helper::~cl_random_def_init_helper()'
  main.cpp:(.text+0x4e0): undefined reference to
  </code>cln::cl_FF_globals_init_helper::cl_FF_globals_init_helper()'
  main.cpp:(.text+0x4e5): undefined reference to
  <code>cln::cl_FF_globals_init_helper::~cl_FF_globals_init_helper()'
  main.cpp:(.text+0x509): undefined reference to
  </code>cln::cl_DF_globals_init_helper::cl_DF_globals_init_helper()'
  main.cpp:(.text+0x50e): undefined reference to
  <code>cln::cl_DF_globals_init_helper::~cl_DF_globals_init_helper()'
  main.cpp:(.text+0x532): undefined reference to
  </code>cln::cl_LF_globals_init_helper::cl_LF_globals_init_helper()'
  main.cpp:(.text+0x537): undefined reference to
  <code>cln::cl_LF_globals_init_helper::~cl_LF_globals_init_helper()'
  /tmp/ccMceM9l.o: In function
  </code>cln::cl_gc_dec_pointer_refcount(cln::cl_heap*)':
  main.cpp:(.text._ZN3cln26cl_gc_dec_pointer_refcountEPNS_7cl_heapE[cln::cl_gc_dec_pointer_refcount(cln::cl_heap*)]+0x28):
  undefined reference to <code>cln::cl_free_heap_object(cln::cl_heap*)'
  /tmp/ccMceM9l.o: In function
  </code>cln::cl_I_classes_dummy::cl_I_classes_dummy()':
  main.cpp:(.text._ZN3cln18cl_I_classes_dummyC1Ev[cln::cl_I_classes_dummy::cl_I_classes_dummy()]+0x9):
  undefined reference to <code>cln::cl_class_fixnum' LinearEquation.o: In
  function</code>LinearEquation::isSolution(cln::cl_R const*, int)':
  LinearEquation.cpp:(.text+0x61a): undefined reference to
  <code>cln::operator*(cln::cl_R const&amp;, cln::cl_R const&amp;)'
  LinearEquation.cpp:(.text+0x636): undefined reference to
  </code>cln::operator+(cln::cl_R const&amp;, cln::cl_R const&amp;)' LinearEquation.o:
  In function <code>__static_initialization_and_destruction_0(int, int)':
  LinearEquation.cpp:(.text+0x741): undefined reference to
  </code>cln::cl_random_def_init_helper::cl_random_def_init_helper()'
  LinearEquation.cpp:(.text+0x746): undefined reference to
  <code>cln::cl_random_def_init_helper::~cl_random_def_init_helper()'
  LinearEquation.cpp:(.text+0x76a): undefined reference to
  </code>cln::cl_FF_globals_init_helper::cl_FF_globals_init_helper()'
  LinearEquation.cpp:(.text+0x76f): undefined reference to
  <code>cln::cl_FF_globals_init_helper::~cl_FF_globals_init_helper()'
  LinearEquation.cpp:(.text+0x793): undefined reference to
  </code>cln::cl_DF_globals_init_helper::cl_DF_globals_init_helper()'
  LinearEquation.cpp:(.text+0x798): undefined reference to
  <code>cln::cl_DF_globals_init_helper::~cl_DF_globals_init_helper()'
  LinearEquation.cpp:(.text+0x7bc): undefined reference to
  </code>cln::cl_LF_globals_init_helper::cl_LF_globals_init_helper()'
  LinearEquation.cpp:(.text+0x7c1): undefined reference to
  <code>cln::cl_LF_globals_init_helper::~cl_LF_globals_init_helper()'
  LinearEquation.o: In function</code>cln::operator==(cln::cl_R const&amp;,
  cln::cl_R const&amp;)':
  LinearEquation.cpp:(.text._ZN3clneqERKNS_4cl_RES2_[cln::operator==(cln::cl_R
  const&amp;, cln::cl_R const&amp;)]+0x14): undefined reference to
  `cln::equal(cln::cl_R const&amp;, cln::cl_R const&amp;)' collect2: ld returned
  1 exit status</p>
</blockquote>
