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


Read syntax diagramSkip visual syntax diagram        .-noidirfirst-.
>>- -q--+-idirfirst---+----------------------------------------><

See also #pragma options.


Use -qidirfirst with the -I 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 option.
  3. Search the standard include directories, which are:

With -qidirfirst, the directories specified with the -I 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, which 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 options [no]idirfirst remains in effect until replaced by a subsequent #pragma options [no]idirfirst.


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

Related information