-I- option

ali hagigat hagigatali@gmail.com
Sun Sep 25 20:07:00 GMT 2011


The below is an extract of the gcc manual:
-------------------------------------------------------------
3.14 Options for Directory Search
-I-
In addition, the ‘-I-’ option inhibits the use of the current directory (where
the current input file came from) as the first search directory for ‘#include
"file "’. There is no way to override this effect of ‘-I-’. With ‘-I.’ you
can specify searching the directory which was current when the compiler was
invoked. That is not exactly the same as what the preprocessor does by default,
but it is often satisfactory.
-------------------------------------------------------------
/root/tmp3> ll prog9.c
-rw-r--r-- 1 root root 283 2011-02-15 10:38 prog9.c
gcc -Itmp3/hd1 -Itmp3/hd2 -I-tmp3/hd3 prog9.c -o prog9

I have used -I- in the above instruction. So what happens? The current
directory,  "/root/tmp3" , is searched for the double quote header
files or not?
the manual says:
"That is not exactly the same as what the preprocessor does by default"
What does it mean? Why the preprocessor must add '-I.'?



More information about the Gcc-help mailing list