On Feb 4, 2007, at 8:56 AM, Douglas Norton wrote: On Feb 3, 2007, at 10:29 PM, Chris Espinosa wrote:
So, to be absolutely clear: <snip>
Actually, I was mistaken. The structure of my project has been changed and I now see that my instance falls into the first scenario you gave
Project Windows ƒ ... Mac ƒ myProj.xcodeproj Code ƒ Application ƒ headerThatIsNotSaved.h headerThatIsNotSaved_MacImp.cpp
So, I save all the files, close all the editors, clean and build. Full build completes properly.
I open 'headerThatIsNotSaved.h' and make a small change, do not manually save, icon is dark (correctly).
Build.
All dependencies are checked, environment variables setup spools in build window, and nothing else. Build succeeded in result window.
This is expected behavior. Unlike CodeWarrior, Xcode builds with the contents of the saved files on disk, not the contents of unsaved files in windows. Manually save the header file, icon back to normal.
Build
The files dependent on the header are recompiled, build completes and succeeds properly.
The only bug I see here is if you had set the behavior in Preferences to Always Save Before Building WIthout Asking and the change to the header file was not saved. If your Save on Build behavior is Don't Save, this is behaving correctly. 'headerThatIsNotSaved.h' is not in the project tree at all. I cannot find it by selecting the project in Groups & Files and typing its name in the search box. It is only referenced from several (12) .cpp files by
#include "headerThatIsNotSaved.h"
This is 100% reproducible, and has workarounds. I will keep this as is should you want me to investigate some more. I can also reproduce this with file pairs whose .h & .cpp have the same name too. The common factor is that the .h does not appear in anywhere in the Groups & Files panel.
Well, headers don't magically appear in the Groups and Files by dint of being referenced by an #include. You have to add them. Xcode allows headers to be part of a project for three reasons:
- to be copied into build products as published interfaces, such as for Frameworks - to be managed by SCM - for ease of file management
A header does not need to be a project member in order to be indexed, searched, or included in a compile; the dependency mechanisms and the search paths will cover all included headers, whether listed in the project or not. There have been bugs in the past, and there may still be cases, where headers not listed in the project and not "first cousins" to the project file (such as in the layout above) are not automatically saved on build even if your preferences are set to save all project files on building. That would be a bug; if this is the case, please write it up.
Your workarounds are: - Save changes manually before building. - Set Xcode to automatically save changes before building if that's not already set. - Add the header to your project if automatic saving is not working correctly.
Chris |