title: Cppunit; trying to compile class to test
body: <p>I am quite new to both C++ and Cppunit. I am trying to compile a little cppunit test. However, I do not succeed.</p>
  
  <pre><code>qwerty@qwerty:~/chessgame/src$ g++ -Wall CoordinateTest.cpp ftest.cpp -lcppunit -o test
  /tmp/cc1vJJqz.o: In function `CoordinateTest::coordinateTest()':
  CoordinateTest.cpp:(.text+0xbb): undefined reference to `Coordinate::Coordinate(int const&amp;, int const&amp;)'
  CoordinateTest.cpp:(.text+0xe2): undefined reference to `Coordinate::Coordinate(int const&amp;, int const&amp;)'
  collect2: ld returned 1 exit status
  </code></pre>
  
  <p>This is the sourcecode. What am I missing here? </p>
  
  <p>----- Coordinate.h -----------------------------------------------------------------</p>
  
  <pre><code>#ifndef COORDINATE_H
  #define COORDINATE_H
  
  class Coordinate
  {
  
      public:
          Coordinate(const int&amp; x, const int&amp; y);
          void setCoordinates(const int&amp; x, const int&amp; y);
          const int&amp; getCoordinateX() const;
          const int&amp; getCoordinateY() const;
  
      private:
          int mX;
          int mY;
  
  };
  
  #endif
  </code></pre>
  
  <p>----- Coordinate.cpp -----------------------------------------------------------------</p>
  
  <pre><code>#include "Coordinate.h"
  
  Coordinate::Coordinate(const int&amp; x, const int&amp; y) : mX(x),mY(y)
  {
  }
  
  void Coordinate::setCoordinates(const int&amp; x, const int&amp; y)
  {
      mX = x;
      mY = y;
  }
  
  const int&amp; Coordinate::getCoordinateX() const
  {
      return mX;
  }
  
  const int&amp; Coordinate::getCoordinateY() const
  {
      return mY;
  }
  </code></pre>
  
  <p>----- CoordinateTest.h -----------------------------------------------------------------</p>
  
  <pre><code>#ifndef COORDINATETEST_H
  #define COORDINATETEST_H
  
  #include &lt;cppunit/TestFixture.h&gt;
  #include &lt;cppunit/extensions/HelperMacros.h&gt;
  #include "Coordinate.h"
  
  class CoordinateTest : public CPPUNIT_NS::TestFixture
  {
      CPPUNIT_TEST_SUITE (CoordinateTest);
      CPPUNIT_TEST (coordinateTest);
      CPPUNIT_TEST_SUITE_END ();
  
      public:
          void setUp();
          void tearDown();
  
  protected:
          void coordinateTest();
  
  };
  
  #endif
  </code></pre>
  
  <p>----- CoordinateTest.cpp -----------------------------------------------------------------</p>
  
  <pre><code>#include "CoordinateTest.h"
  
  CPPUNIT_TEST_SUITE_REGISTRATION (CoordinateTest);
  
  void CoordinateTest::setUp(void)
  {
  
  }
  
  void CoordinateTest::tearDown(void) 
  {
  
  }
  
  void CoordinateTest::coordinateTest(void)
  {
      Coordinate from(1, 0);
      Coordinate to(2, 0);
      CPPUNIT_ASSERT_EQUAL (true, true);
  }
  </code></pre>
  
  <p>----- ftest.cpp -----------------------------------------------------------------</p>
  
  <pre><code>#include "CoordinateTest.h"
  #include &lt;cppunit/CompilerOutputter.h&gt;
  #include &lt;cppunit/extensions/TestFactoryRegistry.h&gt;
  #include &lt;cppunit/TestResult.h&gt;
  #include &lt;cppunit/TestResultCollector.h&gt;
  #include &lt;cppunit/ui/text/TestRunner.h&gt;
  #include &lt;cppunit/BriefTestProgressListener.h&gt;
  
  int main (int argc, char* argv[])
  {
      // informs test-listener about testresults
      CPPUNIT_NS::TestResult testresult;
  
      // register listener for collecting the test-results
      CPPUNIT_NS::TestResultCollector collectedresults;
      testresult.addListener(&amp;collectedresults);
  
      // register listener for per-test progress output
      CPPUNIT_NS::BriefTestProgressListener progress;
      testresult.addListener(&amp;progress);
  
      // insert test-suite at test-runner by registry
      CPPUNIT_NS::TestRunner testrunner;
      testrunner.addTest (CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest());
      testrunner.run(testresult);
  
      // output results in compiler-format
      CPPUNIT_NS::CompilerOutputter compileroutputter(&amp;collectedresults, std::cerr);
      compileroutputter.write();
  
      // return 0 if tests were successful
      return collectedresults.wasSuccessful() ? 0 : 1;
  }
  </code></pre>