Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XCode and header file changes?

10 views
Skip to first unread message

RogueWarrior

unread,
Aug 29, 2006, 2:37:16 PM8/29/06
to
Question:
What is the significance to XCode of a header file not actually being
in the project?
Clearly the compiler is able to see the file because it's part of my
search paths but I'm running into two problems. First, if a header
file isn't in the project does that mean Jump to Definition won't work?
Second, if a header file isn't in the project and you change something
in it, does that prevent XCode from correctly compiling the change.

Example: I change a #define which exists in a header file but that file
isn't in the project.
Behavior: XCode appear to compile some files but during debugging I can
clearly see that the change wasn't seen. I end up having to do a Clean
and full Build to make the change effective.

Patrick Machielse

unread,
Aug 29, 2006, 3:51:35 PM8/29/06
to
RogueWarrior <in...@northernlights3d.com> wrote:

> What is the significance to XCode of a header file not actually being
> in the project?
> Clearly the compiler is able to see the file because it's part of my
> search paths but I'm running into two problems. First, if a header
> file isn't in the project does that mean Jump to Definition won't work?
> Second, if a header file isn't in the project and you change something
> in it, does that prevent XCode from correctly compiling the change.

Which version of Xcode?

Xcode should do the 'obvious' thing in both situations. It tries.
However, there are situations in which Clean / Build cylcles are needed
to fully clear out stale code. Sometimes only the magic of 'Clean all'
will do:

<http://rentzsch.com/notes/doublebroomLiveIt>

patrick

RogueWarrior

unread,
Aug 29, 2006, 8:04:41 PM8/29/06
to
> Which version of Xcode?
>
> Xcode should do the 'obvious' thing in both situations. It tries.
> However, there are situations in which Clean / Build cylcles are needed
> to fully clear out stale code. Sometimes only the magic of 'Clean all'
> will do:

XCode 2.3
Having to recompile over 1400 files gets REALLY tedious after a few
tries.
Are there settings that pertain to macros?

e.g. if I have in a header file (a .h file not a prefix file):

#define Foobar 1

and in a C or C++ file I have:

#if Foobar
...insert award-winning code here...
#endif

Why do I have to clean and build when I change the value of Foobar?
And why if I select Foobar and choose "Jump to Definition" I get
nothing?

And why can't I select some text and option-drag to copy or just drag
to move it?

And when it comes to stewed prunes, are three enough or are four too
many?

Patrick Machielse

unread,
Aug 30, 2006, 4:42:49 AM8/30/06
to
RogueWarrior <in...@northernlights3d.com> wrote:

> > Which version of Xcode?


>
> XCode 2.3
>
> Having to recompile over 1400 files gets REALLY tedious after a few
> tries.

I guess you need a MacPro 3.0. That's what they use inside Apple, and
also why little bugs like these go unnoticed.

> Are there settings that pertain to macros?
>
> e.g. if I have in a header file (a .h file not a prefix file):
>
> #define Foobar 1
>
> and in a C or C++ file I have:
>
> #if Foobar
> ...insert award-winning code here...
> #endif

I think Xcode looks at the timestamps of included files and should
rebuild all files that include files which have a modification date
later than the last build.

> Why do I have to clean and build when I change the value of Foobar?
> And why if I select Foobar and choose "Jump to Definition" I get
> nothing?

Maybe the index has become corrupted. You could try 'Rebuild code sense
index' in the project settings. Alternatively you can close the project
and delete the 'build' folder located in your project folder. The index
will be rebuild automatically when you reopen the project.

> And why can't I select some text and option-drag to copy or just drag
> to move it?

Never seen this behaviour.

> And when it comes to stewed prunes, are three enough or are four too
> many?

wrong newsgroup...

patrick

Mark

unread,
Aug 31, 2006, 4:34:04 PM8/31/06
to

RogueWarrior wrote:
> XCode 2.3
> Having to recompile over 1400 files gets REALLY tedious after a few
> tries.
> Are there settings that pertain to macros?
>
> e.g. if I have in a header file (a .h file not a prefix file):
>
> #define Foobar 1
>
> and in a C or C++ file I have:
>
> #if Foobar
> ...insert award-winning code here...
> #endif
>
> Why do I have to clean and build when I change the value of Foobar?
> And why if I select Foobar and choose "Jump to Definition" I get
> nothing?

Xcode has a Preprocessor Macros build setting in the Preprocessing
collection. You would add your Foobar macro to that build setting. You
could then change the value of Foobar without having to clean and
rebuild.

Mark Szymczyk
Author, Xcode Tools Sensei
http://www.meandmark.com

Michael Ash

unread,
Aug 31, 2006, 9:41:00 PM8/31/06
to

That doesn't really help that much. Xcode will still recompile every
single file in the project after you change a build setting, as it ought
to. Having it there will save you the trouble of having to manually clean
(and the potential of forgetting to), but it doesn't save you from having
to rebuild the entire project. A properly-added header will only trigger a
rebuild of files that #include it.

--
Michael Ash
Rogue Amoeba Software

0 new messages