This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
order of headers lookup
- From: Dima Sorkin <dsorkin at techunix dot technion dot ac dot il>
- To: gcc-help at gcc dot gnu dot org
- Date: Tue, 2 Aug 2005 15:08:43 +0300
- Subject: order of headers lookup
Hi.
This feature of gcc seems strange to me:
Consider a directory structure of a tiny project:
/main.cpp (#include "foo.hpp" )
/d1/bar.hpp
/d2/foo.hpp (#include "bar.hpp")
/d2/bar.hpp
then compiling
> g++ -I d1 -I d2 main.cpp -o main
will include /d2/bar.hpp instead of /d1/bar.hpp as I expected
( I expected so because "d1/" is listed first in "-I" options).
Such a behaviour of g++ limits the use of "sandboxes" in c++
projects ( consider the /d1/ directory as a sandbox of a real project).
Hope I don't miss something.
Thank you.
Dima.