On Nov 20, 2006, at 10:46 PM, Chris Espinosa wrote: But what you seem to be saying is that I have caused the problem by adding the header file to the project, thus causing XCode to do something in the one of its builds phases that makes the header file available to all targets, thus defeating the header search paths above. It's really handy to have on-click access to header files, and seems a pretty typical way of organizing things that most people do , in say, shudder, Visual Studio. So instead of removing the header file can I just make sure the header file(s) is not a member of any target?
I'm not sure that you caused this by adding the headers to the target. It could be a number of things: recursive search paths, A contains B, you added other files from 2's path to 1 earlier so the 2 paths come first in 1's Header Search Paths, etc. One diagnostic would be to add -v to the Other C Flags of each target and compile one source file in each that #includes A.h. The compiler will output the specific search paths in each case, and it's straightforward to see what order it's looking in what directories in, and why.
(Oh, and by the way, notice you said "adding header files to the project" and I replied "adding header files to the target." There's a big difference. Project members are just there, as you say, for one-click access, as well as SCM, etc. But target members are in the list of things to get processed at build time. Include files technically should not be processed unless they're being copied (framework-like) into the build product. They can be referred to by source files that are being processed, of course, but they themselves don't have a build step, so they shouldn't be added to a target. When you add a header file to a project, make sure all the "Add to Targets" boxes are unchecked, unless you specifically want the header file to be copied somewhere at build time.)
Chris |