• 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-2011.09/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, 1989, 1992, 1993, 1994, 1995, 1996, 1997,
141998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
152010 Free Software Foundation, Inc.
16
17Permission is granted to copy, distribute and/or modify this document
18under the terms of the GNU Free Documentation License, Version 1.3 or
19any later version published by the Free Software Foundation; with the
20Invariant Sections being ``Funding Free Software'', the Front-Cover
21Texts being (a) (see below), and with the Back-Cover Texts being (b)
22(see below).  A copy of the license is included in the section entitled
23``GNU Free Documentation License''.
24
25(a) The FSF's Front-Cover Text is:
26
27     A GNU Manual
28
29(b) The FSF's Back-Cover Text is:
30
31     You have freedom to copy and modify this GNU Manual, like GNU
32     software.  Copies published by the Free Software Foundation raise
33     funds for GNU development.-->
34<meta http-equiv="Content-Style-Type" content="text/css">
35<style type="text/css"><!--
36  pre.display { font-family:inherit }
37  pre.format  { font-family:inherit }
38  pre.smalldisplay { font-family:inherit; font-size:smaller }
39  pre.smallformat  { font-family:inherit; font-size:smaller }
40  pre.smallexample { font-size:smaller }
41  pre.smalllisp    { font-size:smaller }
42  span.sc    { font-variant:small-caps }
43  span.roman { font-family:serif; font-weight:normal; } 
44  span.sansserif { font-family:sans-serif; font-weight:normal; } 
45--></style>
46<link rel="stylesheet" type="text/css" href="../cs.css">
47</head>
48<body>
49<div class="node">
50<a name="Directory-Options"></a>
51<p>
52Next:&nbsp;<a rel="next" accesskey="n" href="Spec-Files.html#Spec-Files">Spec Files</a>,
53Previous:&nbsp;<a rel="previous" accesskey="p" href="Link-Options.html#Link-Options">Link Options</a>,
54Up:&nbsp;<a rel="up" accesskey="u" href="Invoking-GCC.html#Invoking-GCC">Invoking GCC</a>
55<hr>
56</div>
57
58<h3 class="section">3.14 Options for Directory Search</h3>
59
60<p><a name="index-directory-options-998"></a><a name="index-options_002c-directory-search-999"></a><a name="index-search-path-1000"></a>
61These options specify directories to search for header files, for
62libraries and for parts of the compiler:
63
64     <dl>
65<dt><code>-I</code><var>dir</var><dd><a name="index-I-1001"></a>Add the directory <var>dir</var> to the head of the list of directories to be
66searched for header files.  This can be used to override a system header
67file, substituting your own version, since these directories are
68searched before the system header file directories.  However, you should
69not use this option to add directories that contain vendor-supplied
70system header files (use <samp><span class="option">-isystem</span></samp> for that).  If you use more than
71one <samp><span class="option">-I</span></samp> option, the directories are scanned in left-to-right
72order; the standard system directories come after.
73
74     <p>If a standard system include directory, or a directory specified with
75<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>
76option will be ignored.  The directory will still be searched but as a
77system directory at its normal position in the system include chain. 
78This is to ensure that GCC's procedure to fix buggy system headers and
79the ordering for the include_next directive are not inadvertently changed. 
80If you really need to change the search order for system directories,
81use the <samp><span class="option">-nostdinc</span></samp> and/or <samp><span class="option">-isystem</span></samp> options.
82
83     <br><dt><code>-iplugindir=</code><var>dir</var><dd>Set the directory to search for plugins which are passed
84by <samp><span class="option">-fplugin=</span><var>name</var></samp> instead of
85<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
86to be used by the user, but only passed by the driver.
87
88     <br><dt><code>-iquote</code><var>dir</var><dd><a name="index-iquote-1002"></a>Add the directory <var>dir</var> to the head of the list of directories to
89be searched for header files only for the case of &lsquo;<samp><span class="samp">#include
90"</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;,
91otherwise just like <samp><span class="option">-I</span></samp>.
92
93     <br><dt><code>-L</code><var>dir</var><dd><a name="index-L-1003"></a>Add directory <var>dir</var> to the list of directories to be searched
94for <samp><span class="option">-l</span></samp>.
95
96     <br><dt><code>-B</code><var>prefix</var><dd><a name="index-B-1004"></a>This option specifies where to find the executables, libraries,
97include files, and data files of the compiler itself.
98
99     <p>The compiler driver program runs one or more of the subprograms
100<samp><span class="file">cpp</span></samp>, <samp><span class="file">cc1</span></samp>, <samp><span class="file">as</span></samp> and <samp><span class="file">ld</span></samp>.  It tries
101<var>prefix</var> as a prefix for each program it tries to run, both with and
102without &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>).
103
104     <p>For each subprogram to be run, the compiler driver first tries the
105<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>
106was not specified, the driver tries two standard prefixes, which are
107<samp><span class="file">/usr/lib/gcc/</span></samp> and <samp><span class="file">/usr/local/lib/gcc/</span></samp>.  If neither of
108those results in a file name that is found, the unmodified program
109name is searched for using the directories specified in your
110<samp><span class="env">PATH</span></samp> environment variable.
111
112     <p>The compiler will check to see if the path provided by the <samp><span class="option">-B</span></samp>
113refers to a directory, and if necessary it will add a directory
114separator character at the end of the path.
115
116     <p><samp><span class="option">-B</span></samp> prefixes that effectively specify directory names also apply
117to libraries in the linker, because the compiler translates these
118options into <samp><span class="option">-L</span></samp> options for the linker.  They also apply to
119includes files in the preprocessor, because the compiler translates these
120options into <samp><span class="option">-isystem</span></samp> options for the preprocessor.  In this case,
121the compiler appends &lsquo;<samp><span class="samp">include</span></samp>&rsquo; to the prefix.
122
123     <p>The run-time support file <samp><span class="file">libgcc.a</span></samp> can also be searched for using
124the <samp><span class="option">-B</span></samp> prefix, if needed.  If it is not found there, the two
125standard prefixes above are tried, and that is all.  The file is left
126out of the link if it is not found by those means.
127
128     <p>Another way to specify a prefix much like the <samp><span class="option">-B</span></samp> prefix is to use
129the environment variable <samp><span class="env">GCC_EXEC_PREFIX</span></samp>.  See <a href="Environment-Variables.html#Environment-Variables">Environment Variables</a>.
130
131     <p>As a special kludge, if the path provided by <samp><span class="option">-B</span></samp> is
132<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
1339, then it will be replaced by <samp><span class="file">[dir/]include</span></samp>.  This is to help
134with boot-strapping the compiler.
135
136     <br><dt><code>-specs=</code><var>file</var><dd><a name="index-specs-1005"></a>Process <var>file</var> after the compiler reads in the standard <samp><span class="file">specs</span></samp>
137file, in order to override the defaults that the <samp><span class="file">gcc</span></samp> driver
138program uses when determining what switches to pass to <samp><span class="file">cc1</span></samp>,
139<samp><span class="file">cc1plus</span></samp>, <samp><span class="file">as</span></samp>, <samp><span class="file">ld</span></samp>, etc.  More than one
140<samp><span class="option">-specs=</span><var>file</var></samp> can be specified on the command line, and they
141are processed in order, from left to right.
142
143     <br><dt><code>--sysroot=</code><var>dir</var><dd><a name="index-sysroot-1006"></a>Use <var>dir</var> as the logical root directory for headers and libraries. 
144For example, if the compiler would normally search for headers in
145<samp><span class="file">/usr/include</span></samp> and libraries in <samp><span class="file">/usr/lib</span></samp>, it will instead
146search <samp><var>dir</var><span class="file">/usr/include</span></samp> and <samp><var>dir</var><span class="file">/usr/lib</span></samp>.
147
148     <p>If you use both this option and the <samp><span class="option">-isysroot</span></samp> option, then
149the <samp><span class="option">--sysroot</span></samp> option will apply to libraries, but the
150<samp><span class="option">-isysroot</span></samp> option will apply to header files.
151
152     <p>The GNU linker (beginning with version 2.16) has the necessary support
153for this option.  If your linker does not support this option, the
154header file aspect of <samp><span class="option">--sysroot</span></samp> will still work, but the
155library aspect will not.
156
157     <br><dt><code>-I-</code><dd><a name="index-I_002d-1007"></a>This option has been deprecated.  Please use <samp><span class="option">-iquote</span></samp> instead for
158<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>. 
159Any directories you specify with <samp><span class="option">-I</span></samp> options before the <samp><span class="option">-I-</span></samp>
160option are searched only for the case of &lsquo;<samp><span class="samp">#include "</span><var>file</var><span class="samp">"</span></samp>&rsquo;;
161they are not searched for &lsquo;<samp><span class="samp">#include &lt;</span><var>file</var><span class="samp">&gt;</span></samp>&rsquo;.
162
163     <p>If additional directories are specified with <samp><span class="option">-I</span></samp> options after
164the <samp><span class="option">-I-</span></samp>, these directories are searched for all &lsquo;<samp><span class="samp">#include</span></samp>&rsquo;
165directives.  (Ordinarily <em>all</em> <samp><span class="option">-I</span></samp> directories are used
166this way.)
167
168     <p>In addition, the <samp><span class="option">-I-</span></samp> option inhibits the use of the current
169directory (where the current input file came from) as the first search
170directory for &lsquo;<samp><span class="samp">#include "</span><var>file</var><span class="samp">"</span></samp>&rsquo;.  There is no way to
171override this effect of <samp><span class="option">-I-</span></samp>.  With <samp><span class="option">-I.</span></samp> you can specify
172searching the directory which was current when the compiler was
173invoked.  That is not exactly the same as what the preprocessor does
174by default, but it is often satisfactory.
175
176     <p><samp><span class="option">-I-</span></samp> does not inhibit the use of the standard system directories
177for header files.  Thus, <samp><span class="option">-I-</span></samp> and <samp><span class="option">-nostdinc</span></samp> are
178independent. 
179</dl>
180
181<!-- man end -->
182 </body></html>
183
184