Include Path for Headers in QT?
In my .pro file for my project, I have an INCLUDEPATH parameters specified to include a set of headers (let's called them 1.h, 2.h, 3.h, etc.). I store them in a shared directory called /shared/projectfolder/include/project, and my INCLUDEPATH in the pro file is:
INCLUDEPATH += /shared/projectfolder/include
However, I also have the same headers 1.h, 2.h, and 3.h in my home directory (~/projectarchive/projectiteration/include/1.h, 2.h, 3.h, etc.), and when I try to create my QT project, instead of picking up the correct headers from /shared/projectfolder/include, it keeps looking at the ones in my home directory. Can anyone suggest why this might be happening?
Try looking at the compilation output (not the issues). Dig down to the exact options with which the compiler ??g++?? is being executed. You will probably find that the
bq. -I (minus sign, capital i)
option appears a couple of times.
The compiler (most compilers) walks through these in the order given until it finds the header it is looking for and it doesn't look any further - doesn't need to, its happy.
If this doesn't bring anything, look at the compiler defaults. These may lead to the headers in your home directory being found first.
If this is the case, options might be:
Ask yourself why you have two copies of the same header
Change the name of the headers
Change the compilation settings in the project configurations / make files.