$SYSROOT, then the ‘ = ’ or
$SYSROOTis replaced by the sysroot prefix; see --sysroot and -isysroot .
Directories specified with
apply only to the quote form of the directive,
. Directories specified with
apply to lookup for both the
You can specify any number or combination of these options on the command line to search for header files in several directories. The lookup order is as follows:
You can use -I to override a system header file, substituting your own version, since these directories are searched before the standard system header file directories. However, you should not use this option to add directories that contain vendor-supplied system header files; use -isystem for that.
The -isystem and -idirafter options also mark the directory as a system directory, so that it gets the same special treatment that is applied to the standard system directories.
If a standard system include directory, or a directory specified with
, is also specified with
option is ignored. The directory is still searched but as a system directory at its normal position in the system include chain. This is to ensure that GCC's procedure to fix buggy system headers and the ordering for the
directive are not inadvertently changed. If you really need to change the search order for system directories, use the
Any directories specified with
are searched only for headers requested with
; they are not searched for
. If additional directories are specified with
options after the
, those directories are searched for all ‘
inhibits the use of the directory of the current file directory as the first search directory for
. There is no way to override this effect of
The compiler driver program runs one or more of the subprograms cpp , cc1 , as and ld . It tries prefix as a prefix for each program it tries to run, both with and without ‘ machine / version / ’ for the corresponding target machine and compiler version.
For each subprogram to be run, the compiler driver first tries the -B prefix, if any. If that name is not found, or if -B is not specified, the driver tries two standard prefixes, /usr/lib/gcc/ and /usr/local/lib/gcc/ . If neither of those results in a file name that is found, the unmodified program name is searched for using the directories specified in your PATH environment variable.
The compiler checks to see if the path provided by -B refers to a directory, and if necessary it adds a directory separator character at the end of the path.
-B prefixes that effectively specify directory names also apply to libraries in the linker, because the compiler translates these options into -L options for the linker. They also apply to include files in the preprocessor, because the compiler translates these options into -isystem options for the preprocessor. In this case, the compiler appends ‘ include ’ to the prefix.
The runtime support file libgcc.a can also be searched for using the -B prefix, if needed. If it is not found there, the two standard prefixes above are tried, and that is all. The file is left out of the link if it is not found by those means.
Another way to specify a prefix much like the -B prefix is to use the environment variable GCC_EXEC_PREFIX . See Environment Variables .
As a special kludge, if the path provided by
, where N
is a number in the range 0 to 9, then it is replaced by
. This is to help with boot-strapping the compiler.
If you use both this option and the -isysroot option, then the --sysroot option applies to libraries, but the -isysroot option applies to header files.
The GNU linker (beginning with version 2.16) has the necessary support for this option. If your linker does not support this option, the header file aspect of
still works, but the library aspect does not.