How to include the specific header file when there are two same files in system include path?

I notice this question:

Two header with same name in include path

But the problem I encounter is the include path is system include path.

Suppose two headers: dir1/header.h dir2/header.h, they are located in system include path, and dir1 is searched firstly, but the one I really want is dir2/header.h. What could I do in this case?

It's in the Android NDK environment.

Suppose the two system include paths are:



Now I want the header in dir2. But the Android compiler will search the header in dir1 firstly. If I used the -I option, How can I change the dir2 path into a platform-independent path (e.g. windows-x86_64 may be linux-x86)?


You must use #include "dir2/header.h" in your source file, then on the compile line you list the parent directory with -I; so for example if the fully-qualified pathname of the second header was /usr/local/include/dir2/header.h you would add -I/usr/local/include to your compile line.


Nate that in makefiles you should always use forward slashes, not backslashes.

Also, the compiler always searches the directories you provide on the command line with -I, in the order you specify them, before it searches any of the standard locations. So I don't really understand the problem. If the default location is the one you don't want anyway, then just add a -I flag pointing to the other one and it'll be used instead.

Need Your Help

How to validate HTML input filed using HTML5

html html5

I have to validate input text field as a phone number field. To do that I'am going to use HTML5 validation.

Set border edges in HorizontalBarChart

android charts bar-chart mpandroidchart

I need help creating this style BarChart, only the rounded end edges.