title: Qt creator: c++: undefined reference to Class::Function
body: <p>I am creating two c++ projects in my Qt creator. The first is an <code>Application project</code> and the other is <code>unit-test project</code>. the two projects, separately, work fine. However, when linking the two together I face a little problem. </p>
  
  <p>I am including <code>#INCLUDEPATH applicationProjectPath</code> in <code>.pro file</code> in the <code>unit-test project</code>. then <code>#include myClass</code> from the application project in the <code>main.cpp</code> of the <code>unit-test project</code>. then, creating a <code>myObject</code> from <code>myClass</code> and calling a function within that object. </p>
  
  <p>when compiling, this error appears: </p>
  
  <pre><code>undefined reference to `myObject::function' 
  </code></pre>
  
  <p>however, when adding <code>#SOURCES applicationProjectPath/myClass.cpp</code> to the .pro file of the unit-test project (while keeping the <code>#INCLUDEPATH applicationProjectPath</code>), everything is working (i.e.: the test units are executed)</p>
  
  <p>again when removing the <code>#INCLUDEPATH</code> from the .pro, it again crashes .</p>
  
  <p>I thought if I included <code>#SOURCES</code>, then I don't need to include the <code>#INCLUDEPATH</code>. and if I included the <code>#INCLUDEPATH</code>, I should not include <code>#SOURCES</code> (at least not with the full path, just the .cpp file and then the compiler should look for both directories, the default one and the added one). </p>
  
  <p>so, my question is: why is this happening </p>