This is not a real problem, because the compiler, when it searches for a
file included from a .h file, should first look in the directory that the
.h file lives in. Here's some gcc documentation on the issue from
http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/Search-Path.html:

GCC looks for headers requested with #include "file" first in the 
directory containing the current file, then in the same places it would 
have looked for a header requested with angle brackets. For example, if 
/usr/include/sys/stat.h contains #include "types.h", GCC looks for types.h 
first in /usr/include/sys, then in its usual search path. 

On Mon, Jul 14, 2003 at 08:36:04PM -0500, Aleksandr Furmanov wrote:
> Hi Ian,
> 
> Thank you for suggestion, I already using similar approach now. It does 
> the job, but this is not what I satisfied with. The main reason why is 
> - even in my sources I am free to write #include <crypto/....h> the 
> library itself does not use such style. So if I have some header with 
> same name as one in the library it is possible to have such include 
> paths that library _will_ use mine. It is likely that library sources 
> will not compile in that case, but I prefer not to bet on that. Also I 
> prefer not to introduce any changes in library code or in its 
> organization structure, because such changes need to be propagated on 
> every library update. Need to add that I have several projects and each 
> of them needs to be modified to contain new include path. So there are 
> workarounds of described issue but if two of us who already did them it 
> is likely that some other people also doing this or will do in the 
> future. IMO it is common problem for the libraries. There are ten 
> libraries in my project and only one of them use 
> <library_name/header.h> approach  - boost.
> 
> -Aleksandr Furmanov.
> 
> > After compiling crypto++ I just created two directories within the
> > cryptopp
> > directory so I ended up with:
> > /cryptopp/cryptopp
> > /cryptopp/lib
> >
> > I then copied the resulting .lib files (I'm using it on windows) into
> > ./lib
> > and the header files into ./cryptopp. After that I set my include
> > directory
> > to /cryptopp and simply used #include <cryptopp/....h> and set my lib
> > directory to cryptopp/lib...
> >
> > This dealt with your first issue, and only took a minute or so...
> >
> > Ian

Reply via email to