title: undefined reference error for all methods of Base class
body: <p>I have following base class and derived class structure.</p>
  
  <p>base/include/Base.h</p>
  
  <pre><code>namespace A
  {
  namespace B
  {
  
  class Base
  {
  public:
      Base();
      Base(const Type type, const Name name);
      virtual ~Base();
  
      // Copy constructor
      Base(const Base&amp; other);
  
      // Assignment operator
      Base&amp; operator= (const Base&amp; rhs);
  
      // Comparison
      bool operator&lt; (const Base&amp; rhs);
  
      std::string toString();
  
      //These enums have been defined in same file above the class
  
      enum Type mType;
      enum Name mName;
  };
  
  }
  }
  </code></pre>
  
  <p>base/src/Base.cpp       </p>
  
  <pre><code>#include "Base.h"
  //and other required includes
  
  namespace A
  {
  namespace B
   {
  
  Base::Base()
  {
  
  }
  
  Base::Base(const Type type, const Name name)
  {
  
  }
  
  Base::~Base()
  {
  
  }
  
  // Copy constructor
  Base::Base(const Base&amp; other)
  {
  
  }
  
  // Assignment operator
  Base&amp; Base::operator= (const Base&amp; rhs)
  {
  
  }
  
  // Comparison
  bool Base::operator&lt; (const Base&amp; rhs)
  {
  
  }
  
  std::string Base::toString()
  {
  
  }
   }
  }
  </code></pre>
  
  <p>base/test/test.h</p>
  
  <pre><code> #include "Base.h"
    namespace A
    {
     namespace B
      {
     class Derived: public Base
     {
  
         public:
      Derived();
      Derived(const Type type, const Name name);
      virtual ~Derived();
  
      Derived(const Derived&amp; other);
      Derived&amp; operator= (const Derived&amp; rhs);
  
      virtual std::string toString();
  };
  
    }
    }
  </code></pre>
  
  <p>base/test/test.cpp</p>
  
  <pre><code>   #include "test.h"
     namespace A
     {
      namespace B
       {
  
  
      Derived::Derived()
      {
  
      }
  
      Derived::Derived(const Type type, const Name name)
      :Base(type, name)
      {
  
      }
  
      Derived::~Derived()
      {
  
      }
  
      Derived::Derived(const Derived&amp; other)
      {
  
      }
  
      Derived&amp; Derived::operator= (const Derived&amp; rhs)
      {
  
      }
  
      std::string Derived::toString()
      {
  
      }
  };
  
      }
   }
  </code></pre>
  
  <p>Now, I am building libBase.a for Base class directory.
  And then I am trying to compile Derived class on command line like this in base/test directory:</p>
  
  <pre><code> g++ *.cpp -o Test  \
    -I /cygdrive/c/projects/base/include \
    -L /cygdrive/c/projects/base/Build -lBase
  </code></pre>
  
  <p>But I get errors like:</p>
  
  <pre><code>/tmp/ccjLwXZp.o:Derived.cpp:(.text+0x10d): undefined reference to `A::B::Base::Base()
  /tmp/ccjLwXZp.o:Derived.cpp:(.text+0x129): undefined reference to `A::B::Base::Base()
  /tmp/ccjLwXZp.o:Derived.cpp:(.text+0x161): undefined reference to `A::B::base::Base(const Type type, const Name name)'
  </code></pre>
  
  <p>These errors I get for all the functions defined in base class.
    I am not sure, what is it that I am doing wrong.
    I have checked that libBase.a is in proper place</p>