Re: Where to include header files - relates to last question on variable scope
Re: Where to include header files - relates to last question on variable scope
- Subject: Re: Where to include header files - relates to last question on variable scope
- From: Ole Voß <email@hidden>
- Date: Mon, 01 Nov 2004 13:14:59 +0100
Jiri Volejnik wrote:
Why do I have to include the header file of this singleton class in
every
other class I use it in? Should the class not be available to the
compiler
the moment it's included in the 'main.m'?
Every source file is compiled separately in C, C++ and Objective-C. If
there are some external declarations needed for the compilation, than
you have to #include or #import the appropriate header file. If you
need some declaration to be available in every source file of your
project, then you also have to #include or #import the header file in
every source file. That's simply the way it is.
If you really want some declarations to be available anywhere in your
app without #importing it, you can declare it (or #import it) just
once - in precompiled header. However, note that this is not the
primary purpose of the precompiled header. Main purpose of the
precompiled header is to speed up compilation. Only rarely changed
declarations should therefore appear in the precompiled header. Every
change in the precompiled header or in any header #imported by
precompiled header will cause recompilation of all source files in
your project.
Still, I think that you should not hang around a mailing list like
cocoa-dev if you feel bothered by questions posed by people
less-knowing than you. Afterall you might need help from me someday
for something that does not seem 'basic' to you.
I'm surprised by this reaction. The guys were trying to help you,
spending their time, although the question doesn't come under
cocoa-dev. You could be RTFM'd instead.
-- Jirka
I was not referring to everybody that posted a reply - just to one
specific person. And I'd be happy to RTFM if anybody could finally name
me the 'F' Manual that I should be reading!
I don't understand why this question doesn't relate to cocoa?! I use
obj-c to do cocoa programming, don't I? It's like saying gasoline
doesn't relate to my engine ;-)
Regards,
Ole.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden