Robert P. J. Day wrote:
On Tue, 11 Jan 2005, Alessandro Vesely wrote:
but, as i read the gcc man page, using
#include "aeou.h"
will *always* search the current directory first, regardless of what
you add with "-I". it's my understanding that additional directories
you supply with "-I" will be searched after the current dir, but
before the standard system dirs.
is that not correct?
It depends ... on what you mean by "current directory".
Technically speaking, the C++ standard says that the behaviour of #include ""
is implementation-dependent. Practically speaking, IME, all compilers provide the same
behaviour -- search first in the directory of the includer.
Try it out:
// foo/bar.h
#include "baz.h"
#warning __FILE__
// foo/baz.h
#warning __FILE__
// bar/baz.c
#include "baz.h"
#include <foo/bar.h>
// bar/baz.h
#warning __FILE__
Then build from the directory bar with foo's parent directory in the
include path. Here's what I get:
yapn:[EMAIL PROTECTED]:~/aoeu/bar> gmake baz CPPFLAGS="-I$HOME/aoeu"
cc -I/ms/user/y/yapn/aoeu baz.c -o baz
In file included from baz.c:1:
baz.h:1:2: warning: #warning __FILE__
In file included from /ms/user/y/yapn/aoeu/foo/bar.h:1,
from baz.c:3:
/ms/user/y/yapn/aoeu/foo/baz.h:1:2: warning: #warning __FILE__
In file included from baz.c:3:
/ms/user/y/yapn/aoeu/foo/bar.h:3:2: warning: #warning __FILE__
Noel
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make