PDA

View Full Version : QMake's INCLUDEPATH and DEPENDPATH problems.



JPNaude
2nd December 2008, 07:16
Hi

After using Qt for about 4 months now, I decided to understand the INCLUDEPATH and DEPENDPATH qmake options completely, since I end up with include type errors more than often:

From the documentation:
DEPENDPATH

This variable contains the list of all directories to look in to resolve dependencies. This will be used when crawling through included files.

INCLUDEPATH

This variable specifies the #include directories which should be searched when compiling the project. Use ';' or a space as the directory separator.

Two questions:
1) Can someone please explain this better. INCLUDEPATH will be used during compilation, and DEPENDPATH during linking? Is this correct?
2) The paths included using these commands are relative to which directories? If I, for example have something like this: INCLUDEPATH += ./../../Framework. Will this be relative to the directory in which the .pro file is sitting? Or relative to every file in my project?

At the moment for example I'm sitting with the following problem which I don't understand. I have:
INCLUDEPATH += ../../../Framework/Headers/Variables \

and in one of the file included in the library generated by this .pro file I have:
#include <Variable.h>
which is in the above directory.

Why doesn't work? I get:
source\DataComponentStructs.h:9:22: Variable.h: No such file or directory

Please give some guidance,
Thanks
Jaco

jpn
2nd December 2008, 11:31
INCLUDEPATH is used during compilation to find included header files. DEPENDPATH is used to resolve dependencies between header and source files, eg. which source files need to be recompiled when certain header file changes. If you modify a header file in folder foo/ and foo/ is not listed in DEPENDPATH, nothing gets recompiled. If foo/ is listed in DEPENDPATH, source files depending on that header will get recompiled. Paths can be relative to the .pro file or absolute paths.