Searching include paths
Damien Kick
dkick1@me.com
Sat Apr 23 00:11:00 GMT 2011
-I- is deprecated. Is this the only option that allows for one to
disable having quoted-include search the current directory of the file
doing the quoted-include? Is there any option with which one can
cause the specified directory to be searching before the current
directory of the file doing the quoted-include? Consider, for
example, the following:
localhost:foo dkick$ pwd
/Users/dkick/tmp/work
localhost:work dkick$ find . -type f -exec echo {} \; -exec cat {} \;
./bar/baz/qux.hh
// Hooray!
./foo/baz/qux.hh
#error Frack!
./foo/qux.cc
#include "baz/qux.hh"
localhost:work dkick$ cd foo
localhost:foo dkick$ g++ -c -I ~/tmp/work/bar -I- qux.cc
cc1plus: note: obsolete option -I- used, please use -iquote instead
localhost:foo dkick$ g++ -c -iquote ~/tmp/work/bar qux.cc
In file included from qux.cc:1:
baz/qux.hh:1:2: error: #error Frack!
localhost:foo dkick$
Because the path specified by -iquote does not come before the current
directory of "qux.cc", the compilation example which uses -iquote is
finding "~/tmp/work/foo/baz/qux.hh". I can't quite think of a way to
get a compilation to find the Right File (TM), assuming the same
directory structure and file contents, without using -I-. Is there
some way to do it?
Now... I'm not claiming in any way that this example directory
structure is a Good Idea (TM) or anything. It's just a hypothetical.
More information about the Gcc-help
mailing list