Re: order of headers lookup

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quoting Arturas Moskvinas :
> > 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).
> 
> It is from C preprocessor manual:
> #include "file"
>     This variant is used for header files of your own program. It
> searches for a file named file first in the directory containing the
> current file, then in the same directories used for <file>.
> 
> So, i think you should use #include <bar.hpp> to get your wanted behavior...

Yes, it works.
  Thank you.
 Dima.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux