I am creating two c++ projects in my Qt creator. The first is an Application project
and the other is unit-test project
. the two projects, separately, work fine. However, when linking the two together I face a little problem.
I am including #INCLUDEPATH applicationProjectPath
in .pro file
in the unit-test project
. then #include myClass
from the application project in the main.cpp
of the unit-test project
. then, creating a myObject
from myClass
and calling a function within that object.
when compiling, this error appears:
undefined reference to `myObject::function'
however, when adding #SOURCES applicationProjectPath/myClass.cpp
to the .pro file of the unit-test project (while keeping the #INCLUDEPATH applicationProjectPath
), everything is working (i.e.: the test units are executed)
again when removing the #INCLUDEPATH
from the .pro, it again crashes .
I thought if I included #SOURCES
, then I don't need to include the #INCLUDEPATH
. and if I included the #INCLUDEPATH
, I should not include #SOURCES
(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).
so, my question is: why is this happening