• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/toolchains/hndtools-armeabi-2013.11/share/doc/arm-arm-none-eabi/html/gcc/
1<html lang="en">
2<head>
3<title>Directory Options - Using the GNU Compiler Collection (GCC)</title>
4<meta http-equiv="Content-Type" content="text/html">
5<meta name="description" content="Using the GNU Compiler Collection (GCC)">
6<meta name="generator" content="makeinfo 4.13">
7<link title="Top" rel="start" href="index.html#Top">
8<link rel="up" href="Invoking-GCC.html#Invoking-GCC" title="Invoking GCC">
9<link rel="prev" href="Link-Options.html#Link-Options" title="Link Options">
10<link rel="next" href="Spec-Files.html#Spec-Files" title="Spec Files">
11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
12<!--
13Copyright (C) 1988-2013 Free Software Foundation, Inc.
14
15Permission is granted to copy, distribute and/or modify this document
16under the terms of the GNU Free Documentation License, Version 1.3 or
17any later version published by the Free Software Foundation; with the
18Invariant Sections being ``Funding Free Software'', the Front-Cover
19Texts being (a) (see below), and with the Back-Cover Texts being (b)
20(see below).  A copy of the license is included in the section entitled
21``GNU Free Documentation License''.
22
23(a) The FSF's Front-Cover Text is:
24
25     A GNU Manual
26
27(b) The FSF's Back-Cover Text is:
28
29     You have freedom to copy and modify this GNU Manual, like GNU
30     software.  Copies published by the Free Software Foundation raise
31     funds for GNU development.-->
32<meta http-equiv="Content-Style-Type" content="text/css">
33<style type="text/css"><!--
34  pre.display { font-family:inherit }
35  pre.format  { font-family:inherit }
36  pre.smalldisplay { font-family:inherit; font-size:smaller }
37  pre.smallformat  { font-family:inherit; font-size:smaller }
38  pre.smallexample { font-size:smaller }
39  pre.smalllisp    { font-size:smaller }
40  span.sc    { font-variant:small-caps }
41  span.roman { font-family:serif; font-weight:normal; } 
42  span.sansserif { font-family:sans-serif; font-weight:normal; } 
43--></style>
44<link rel="stylesheet" type="text/css" href="../cs.css">
45</head>
46<body>
47<div class="node">
48<a name="Directory-Options"></a>
49<p>
50Next:&nbsp;<a rel="next" accesskey="n" href="Spec-Files.html#Spec-Files">Spec Files</a>,
51Previous:&nbsp;<a rel="previous" accesskey="p" href="Link-Options.html#Link-Options">Link Options</a>,
52Up:&nbsp;<a rel="up" accesskey="u" href="Invoking-GCC.html#Invoking-GCC">Invoking GCC</a>
53<hr>
54</div>
55
56<h3 class="section">3.14 Options for Directory Search</h3>
57
58<p><a name="index-directory-options-1055"></a><a name="index-options_002c-directory-search-1056"></a><a name="index-search-path-1057"></a>
59These options specify directories to search for header files, for
60libraries and for parts of the compiler:
61
62     <dl>
63<dt><code>-I</code><var>dir</var><dd><a name="index-I-1058"></a>Add the directory <var>dir</var> to the head of the list of directories to be
64searched for header files.  This can be used to override a system header
65file, substituting your own version, since these directories are
66searched before the system header file directories.  However, you should
67not use this option to add directories that contain vendor-supplied
68system header files (use <samp><span class="option">-isystem</span></samp> for that).  If you use more than
69one <samp><span class="option">-I</span></samp> option, the directories are scanned in left-to-right
70order; the standard system directories come after.
71
72     <p>If a standard system include directory, or a directory specified with
73<samp><span class="option">-isystem</span></samp>, is also specified with <samp><span class="option">-I</span></samp>, the <samp><span class="option">-I</span></samp>
74option is ignored.  The directory is still searched but as a
75system directory at its normal position in the system include chain. 
76This is to ensure that GCC's procedure to fix buggy system headers and
77the ordering for the <code>include_next</code> directive are not inadvertently changed. 
78If you really need to change the search order for system directories,
79use the <samp><span class="option">-nostdinc</span></samp> and/or <samp><span class="option">-isystem</span></samp> options.
80
81     <br><dt><code>-iplugindir=</code><var>dir</var><dd>Set the directory to search for plugins that are passed
82by <samp><span class="option">-fplugin=</span><var>name</var></samp> instead of
83<samp><span class="option">-fplugin=</span><var>path</var><span class="option">/</span><var>name</var><span class="option">.so</span></samp>.  This option is not meant
84to be used by the user, but only passed by the driver.
85
86     <br><dt><code>-iquote</code><var>dir</var><dd><a name="index-iquote-1059"></a>Add the directory <var>dir</var> to the head of the list of directories to
87be searched for header files only for the case of &lsquo;<samp><span class="samp">#include
88"</span><var>file</var><span class="samp">"</span></samp>&rsquo;; they are not searched for &lsquo;<samp><span class="samp">#include &lt;</span><var>file</var><span class="samp">&gt;</span></samp>&rsquo;,
89otherwise just like <samp><span class="option">-I</span></samp>.
90
91     <br><dt><code>-L</code><var>dir</var><dd><a name="index-L-1060"></a>Add directory <var>dir</var> to the list of directories to be searched
92for <samp><span class="option">-l</span></samp>.
93
94     <br><dt><code>-B</code><var>prefix</var><dd><a name="index-B-1061"></a>This option specifies where to find the executables, libraries,
95include files, and data files of the compiler itself.
96
97     <p>The compiler driver program runs one or more of the subprograms
98<samp><span class="command">cpp</span></samp>, <samp><span class="command">cc1</span></samp>, <samp><span class="command">as</span></samp> and <samp><span class="command">ld</span></samp>.  It tries
99<var>prefix</var> as a prefix for each program it tries to run, both with and
100without &lsquo;<samp><var>machine</var><span class="samp">/</span><var>version</var><span class="samp">/</span></samp>&rsquo; (see <a href="Target-Options.html#Target-Options">Target Options</a>).
101
102     <p>For each subprogram to be run, the compiler driver first tries the
103<samp><span class="option">-B</span></samp> prefix, if any.  If that name is not found, or if <samp><span class="option">-B</span></samp>
104is not specified, the driver tries two standard prefixes,
105<samp><span class="file">/usr/lib/gcc/</span></samp> and <samp><span class="file">/usr/local/lib/gcc/</span></samp>.  If neither of
106those results in a file name that is found, the unmodified program
107name is searched for using the directories specified in your
108<samp><span class="env">PATH</span></samp> environment variable.
109
110     <p>The compiler checks to see if the path provided by the <samp><span class="option">-B</span></samp>
111refers to a directory, and if necessary it adds a directory
112separator character at the end of the path.
113
114     <p><samp><span class="option">-B</span></samp> prefixes that effectively specify directory names also apply
115to libraries in the linker, because the compiler translates these
116options into <samp><span class="option">-L</span></samp> options for the linker.  They also apply to
117includes files in the preprocessor, because the compiler translates these
118options into <samp><span class="option">-isystem</span></samp> options for the preprocessor.  In this case,
119the compiler appends &lsquo;<samp><span class="samp">include</span></samp>&rsquo; to the prefix.
120
121     <p>The runtime support file <samp><span class="file">libgcc.a</span></samp> can also be searched for using
122the <samp><span class="option">-B</span></samp> prefix, if needed.  If it is not found there, the two
123standard prefixes above are tried, and that is all.  The file is left
124out of the link if it is not found by those means.
125
126     <p>Another way to specify a prefix much like the <samp><span class="option">-B</span></samp> prefix is to use
127the environment variable <samp><span class="env">GCC_EXEC_PREFIX</span></samp>.  See <a href="Environment-Variables.html#Environment-Variables">Environment Variables</a>.
128
129     <p>As a special kludge, if the path provided by <samp><span class="option">-B</span></samp> is
130<samp><span class="file">[dir/]stage</span><var>N</var><span class="file">/</span></samp>, where <var>N</var> is a number in the range 0 to
1319, then it is replaced by <samp><span class="file">[dir/]include</span></samp>.  This is to help
132with boot-strapping the compiler.
133
134     <br><dt><code>-specs=</code><var>file</var><dd><a name="index-specs-1062"></a>Process <var>file</var> after the compiler reads in the standard <samp><span class="file">specs</span></samp>
135file, in order to override the defaults which the <samp><span class="command">gcc</span></samp> driver
136program uses when determining what switches to pass to <samp><span class="command">cc1</span></samp>,
137<samp><span class="command">cc1plus</span></samp>, <samp><span class="command">as</span></samp>, <samp><span class="command">ld</span></samp>, etc.  More than one
138<samp><span class="option">-specs=</span><var>file</var></samp> can be specified on the command line, and they
139are processed in order, from left to right.
140
141     <br><dt><code>--sysroot=</code><var>dir</var><dd><a name="index-sysroot-1063"></a>Use <var>dir</var> as the logical root directory for headers and libraries. 
142For example, if the compiler normally searches for headers in
143<samp><span class="file">/usr/include</span></samp> and libraries in <samp><span class="file">/usr/lib</span></samp>, it instead
144searches <samp><var>dir</var><span class="file">/usr/include</span></samp> and <samp><var>dir</var><span class="file">/usr/lib</span></samp>.
145
146     <p>If you use both this option and the <samp><span class="option">-isysroot</span></samp> option, then
147the <samp><span class="option">--sysroot</span></samp> option applies to libraries, but the
148<samp><span class="option">-isysroot</span></samp> option applies to header files.
149
150     <p>The GNU linker (beginning with version 2.16) has the necessary support
151for this option.  If your linker does not support this option, the
152header file aspect of <samp><span class="option">--sysroot</span></samp> still works, but the
153library aspect does not.
154
155     <br><dt><code>--no-sysroot-suffix</code><dd><a name="index-no_002dsysroot_002dsuffix-1064"></a>For some targets, a suffix is added to the root directory specified
156with <samp><span class="option">--sysroot</span></samp>, depending on the other options used, so that
157headers may for example be found in
158<samp><var>dir</var><span class="file">/</span><var>suffix</var><span class="file">/usr/include</span></samp> instead of
159<samp><var>dir</var><span class="file">/usr/include</span></samp>.  This option disables the addition of
160such a suffix.
161
162     <br><dt><code>-I-</code><dd><a name="index-I_002d-1065"></a>This option has been deprecated.  Please use <samp><span class="option">-iquote</span></samp> instead for
163<samp><span class="option">-I</span></samp> directories before the <samp><span class="option">-I-</span></samp> and remove the <samp><span class="option">-I-</span></samp>. 
164Any directories you specify with <samp><span class="option">-I</span></samp> options before the <samp><span class="option">-I-</span></samp>
165option are searched only for the case of &lsquo;<samp><span class="samp">#include "</span><var>file</var><span class="samp">"</span></samp>&rsquo;;
166they are not searched for &lsquo;<samp><span class="samp">#include &lt;</span><var>file</var><span class="samp">&gt;</span></samp>&rsquo;.
167
168     <p>If additional directories are specified with <samp><span class="option">-I</span></samp> options after
169the <samp><span class="option">-I-</span></samp>, these directories are searched for all &lsquo;<samp><span class="samp">#include</span></samp>&rsquo;
170directives.  (Ordinarily <em>all</em> <samp><span class="option">-I</span></samp> directories are used
171this way.)
172
173     <p>In addition, the <samp><span class="option">-I-</span></samp> option inhibits the use of the current
174directory (where the current input file came from) as the first search
175directory for &lsquo;<samp><span class="samp">#include "</span><var>file</var><span class="samp">"</span></samp>&rsquo;.  There is no way to
176override this effect of <samp><span class="option">-I-</span></samp>.  With <samp><span class="option">-I.</span></samp> you can specify
177searching the directory that is current when the compiler is
178invoked.  That is not exactly the same as what the preprocessor does
179by default, but it is often satisfactory.
180
181     <p><samp><span class="option">-I-</span></samp> does not inhibit the use of the standard system directories
182for header files.  Thus, <samp><span class="option">-I-</span></samp> and <samp><span class="option">-nostdinc</span></samp> are
183independent. 
184</dl>
185
186<!-- man end -->
187 </body></html>
188
189