Re: Including specific headers
Re: Including specific headers
- Subject: Re: Including specific headers
- From: Chris Espinosa <email@hidden>
- Date: Thu, 1 Jun 2006 12:53:28 -0700
On Jun 1, 2006, at 11:49 AM, Rick Mann wrote:Hi. I'm just starting to use XCode (having finally been forced to abandon my beloved CodeWarrior by the Intel machines). I'm working on a Carbon application.
As I understand it, pretty much all the headers are precompiled and automatically included for all translation units.
Only because most Xcode project templates are set up to do this. However, I really like having the most specific header explicitly included in my files (for the various symbols referenced in it). For example, if I reference a CGRect, I want to include CGGeometry.h explicitly.
I tried this:
#include <CoreGraphics/CGGeometry.h>
but XCode complains that that file could not be found.
There are a lot of reasons for this that I'd rather not get into; I just want to know how to do it.
While this is not the recommended way to include framework header files, it is supported. The twist here is that CoreGraphics is a subframework of ApplicationServices. If you insist on using this style of #include, you'll have to add "/System/Library/Frameworks/ApplicationServices.frameworks/Frameworks" as a Framework Search Path in all configurations for your target that needs this. Futhermore, is there a way to disable the precompiled header so that I know when I fail to included a necessary header (without by chance, disabling the ability to find a symbol in the headers via the contextual menus)?
Just uncheck the "Precompile Prefix Header" build setting in the Target inspector. But that generally won't have any effect; your prefix file will still be included implicitly, and if it #includes an umbrella framework (like <Carbon/Carbon.h> then pretty much everything you'll ever use will be brought in, too, just more slowly. You can comment out the framework includes in the prefix file, but that will probably result in more breakage than you want to deal with.
The best thing to do is just to give up on worrying about system-level #includes. The whole point of framework #includes and umbrella frameworks on Mac OS X is to reduce the hassle of figuring out what headers and link libraries you need to add in order to use standard system functionality.
Chris |
_______________________________________________
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