Re: next problem
Re: next problem
- Subject: Re: next problem
- From: Greg Guerin <email@hidden>
- Date: Tue, 19 Jun 2007 22:51:10 -0700
David Goldsmith wrote:
>So, putting /usr/include at the beginning should fix this problem...
>
>$ echo $CPATH
>/usr/include:/usr/local/include/vtk-5.0:...etc.
This may no longer be relevant to fixing the problem, but it might be
relevant to understanding it...
First, the problem arises from this line in ostream.tcc, at line 45:
#include <locale>
This takes no detective work, just look at the error message:
In file included from /usr/include/c++/4.0.0/bits/ostream.tcc:45
So given this, consider two possible ways the compiler could use CPATH and
the available list of include-dirs:
A) It can traverse the list looking in each location first fora "locale"
file, then for a "local.h" file. This is roughly "depth-first" or "deep
probe"; it probes one directly completely, exhausting it of all possible
matches, then it moves to the next one, traversing the entire list no more
than once.
B) It can traverse the list looking in each location for a "locale" file,
then it traverses the list again looking in each location for a "locale.h"
file. This is roughly "breadth-first" or "shallow probe". It tests each
dir once for one file, then moves on, traversing the entire list multiple
times.
Now, the only way that preceding CPATH with /usr/include would fix the
problem is if the compiler evaluates depth-first, i.e. strategy A. If it
evaluates breadth-first (B), then the presumed fix can't possibly work.
The first traversal, making one probe at each location, only looks for
"locale", and that's always found first in /usr/bin. Once that happens
it's end of story.
Off the top of my head, I don't know which strategy GCC uses, but the
evidence suggests B. There's probably something about it in the voluminous
man page, but finding it might not be easy. A project for a rainy weekend.
Maybe there's a standard way that compilers HAVE to search include-dirs, in
which case the Standard would describe this. Otherwise there isn't, and it
could be either one, or even something different. I've seen it done both
ways in different compilers from different mfgrs, so assuming it'll always
be done only one way is dangerous.
In the words of Will Rogers:
"It isn't what we don't know that gives us trouble,
it's what we know that ain't so."
-- GG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden