idirfirst

Option Type Default Value #pragma options C C++
-qoption noidirfirst IDIRFirst x x

Syntax

    -qidirfirst | -qnoidirfirst 
    IDIRFirst | NOIDIRFirst 

Purpose
Specifies the search order for files included with the #include "file_name" directive.

Notes
Use -qidirfirst with the -I directory option.

The normal search order (for files included with the #include "file_name" directive) without the idirfirst option is:

  1. Search the directory where the current source file resides.
  2. Search the directory or directories specified with the -I directory option.
  3. Search the standard include directories, which are:

With -qidirfirst, the directories specified with the -I directory option are searched before the directory where the current file resides.

-qidirfirst has no effect on the search order for the #include <file_name> directive.

-qidirfirst is independent of the -qnostdinc option. (-qnostdinc changes the search order for both #include "file_name" and #include <file_name>.

The search order of files is described in Directory Search Sequence for Include Files Using Relative Path Names.

The last valid #pragma option [NO]IDIRFirst remains in effect until replaced by a subsequent #pragma option [NO]IDIRFirst.

Example
To compile myprogram.c and search /usr/tmp/myinclude for included files before searching the current directory (where the source file resides), enter:

xlC myprogram.c -I/usr/tmp/myinclude -qidirfirst


List of Batch Compiler Options and Their Defaults
Equivalent Batch Compile-Link and Incremental Build Options