tags:

views:

22

answers:

1

Hi,

In CINCLUDE path in my make file there are two headers with same name.

I cannot remove one of them . How can I instruct makefile to give priority to header files in a specific folder.

+3  A: 

This is usually something specified by the compiler. For example with gcc, you can create the following files:

qq.c:
    #include <qq.h>
    int main (void) {
        return 0;
    }
1/qq.h:
    #error file number 1
2/qq.h:
    #error file number 2

Then, when you compile them:

pax> gcc -I1 -I2 -o qq qq.c
In file included from qq.c:1:
1/qq.h:1:2: #error file number 1

pax> gcc -I2 -I1 -o qq qq.c
In file included from qq.c:1:
2/qq.h:1:2: #error file number 2

In other words, it's the order in which the include paths are specified (with -I) which dictates the order of search (there are other things such as whether headers are named the same as system headers but they need not concern us here).

paxdiablo