On Wed, Jan 26, 2011 at 10:53:26AM +0000, Tomalak Geret'kal wrote:
> On 26/01/2011 10:47, Jonathan Wakely wrote:
> >On 26 January 2011 10:38, dan g. wrote:
> >>Wow, thank you, I did accidentally have an include path that went one too
> >>into ZThread's includes structure.. and there was a Time.h in there.
> >Eurgh - the perils of case independent filesystems!
> And of stupid header names. And of having broken include
> paths. :)
I dare to diverge from the MySQL++ topic to say that there's nothing
stupid about having a header named time.h.
You just need to realize that, to use it, use:
And to use the system version, use:
If you keep your application or library headers in their own subdirectory,
Then you can include properly, like:
or, if the directory in which the mylib/ directory resides is in your include
Note that when mylib.h itself needs to include its own time.h, it just
does the same thing:
And everything works out as it should.
It is when programmers don't understand the flexibility of these include
rules that problems occur. There is nothing magical about the filenames.
The rule is:
searches first in the same directory as the file that is doing the including.
That is, any quoted includes inside mylib/mylib.h will first be searched for
in the mylib/ directory, even if some .c file in some other random directory
was the file that first included <mylib/mylib.h>.
will search first in the compiler's include path list.