title: c++ linker error - 'undefined reference' to not inline defined functions
body: <p>For few days I'm trying to compile one project written in C++ using Code::Blocks IDE (on Linux, Ubuntu 64-bit). Code is valid but there are some linker errors. I noticed that I get errors 'undefined reference' for functions which are not inline defined in classes and are in other files (class is i *.h file and definitions on these functions are in *.cpp). I tried to write my own Makefile but it didn't help.</p>
  
  <p>Makefile:</p>
  
  <pre><code>all: project
  
  project: main.o DList.o Person.o
      g++ main.o DList.o Person.o -o project
  
  main.o: main.cpp
      g++ -c main.cpp
  
  DList.o: include/DList.cpp
      g++ -c include/DList.cpp
  
  Person.o: include/Person.cpp
      g++ -c include/Person.cpp
  
  clean:
      rm -rf *.o
  </code></pre>
  
  <p>I don't know what should I do although I read some about these errors on the net.</p>
  
  <p>// EDIT
  I changed Object.cpp and Object.h to Person.cpp and Person.h, moved *.cpp files to main directory and changed #include paths in *.cpp files.</p>
  
  <p>Errors:</p>
  
  <pre><code>obj/Debug/main.o||In function `main':|
  ...main.cpp|19|undefined reference to `DListIterator&lt;Person&gt;::go(int)'|
  ...main.cpp|20|undefined reference to `std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp; operator&lt;&lt; &lt;Person&gt;(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;, DList&lt;Person&gt;&amp;)'|
  ...main.cpp|21|undefined reference to `DList&lt;Person&gt;::~DList()'|
  ...main.cpp|21|undefined reference to `DList&lt;Person&gt;::~DList()'|
  obj/Debug/main.o||In function `DList&lt;Person&gt;::insert(Person&amp;)':|
  ...include/DList.h|45|undefined reference to `DList&lt;Person&gt;::insert(Person&amp;, DListIterator&lt;Person&gt;&amp;)'|
  ||=== Build finished: 5 errors, 0 warnings ===|
  </code></pre>
  
  <p>It makes no difference if I build starting make in command line or using Build function in Code::Blocks.</p>
  
  <p>When I copied all code from *.cpp files to *.h files, compiler returned no errors, so I think that it's only linker problem.</p>