This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]