From: R on
These header files are making me queasy! I'm never sure which one to
include.

For example, I'm doing some C++ programming for an open-source
project. I need to find where 'kCGDirectMainDisplay' is defined. It
turns out it's in 'CGDirectDisplay.h', which is a header belonging
to the CoreGraphics framework. So I try to include that, but I
can't. Hmmph. How about including 'CoreGraphics.h'? Well, that
doesn't work either. It seems to have worked for people in the past
because I can find numerous instances of '#include
<CoreGraphics/CoreGraphics.h>' online. But it's not working for me,
even if I do compile with '-framework CoreGraphics'. And then I
recalled something about umbrella frameworks. From Apple's developer
documentation:

"Mac OS X includes two mechanisms for ensuring that developers link
only with umbrella frameworks. One mechanism is an Xcode feature
that prevents you from selecting subframeworks. The other mechanism
is a compile-time error that occurs when you attempt to include
subframework header files."

So, is this what's happening? I notice that CoreGraphics is nested
within ApplicationServices. If I include 'ApplicationServices.h',
then I find that the symbol 'kCGDirectMainDisplay' *is* now defined.
So it's looking like I can only include headers directly under
'/System/Library/Frameworks/*.framework/Headers', with some suitable
substitution for '*'. Is that true? And if so, how do I determine
which one to include if I end up in another situation like the one
above? Do I traverse up the directory structure until I reach an
umbrella framework and then rummage around in the headers
belonging to that?

It's looking like umbrella frameworks aren't just to be saved for a
rainy day!

Cheers!
From: Jim on
On 2010-03-04, R <me32(a)privacy.net> wrote:

<snip>

I can't help with this, sorry, but I've had some luck posting such questions
in comp.sys.mac.programmer.help

Jim
--
http://www.ursaMinorBeta.co.uk http://twitter.com/GreyAreaUK

"Get over here. Now. Might be advisable to wear brown trousers
and a shirt the colour of blood." Malcolm Tucker, "The Thick of It"
From: R on
Jim <jim(a)magrathea.plus.com> wrote:

> On 2010-03-04, R <me32(a)privacy.net> wrote:
>
> <snip>
>
> I can't help with this, sorry, but I've had some luck posting such questions
> in comp.sys.mac.programmer.help

Ah, thanks. Perhaps it wasn't the best question to pose here.
I will try that other group in a little while if I have no luck here.

Cheers.
From: Jim on
On 2010-03-04, R <me32(a)privacy.net> wrote:
>>
>> <snip>
>>
>> I can't help with this, sorry, but I've had some luck posting such questions
>> in comp.sys.mac.programmer.help
>
> Ah, thanks. Perhaps it wasn't the best question to pose here.
> I will try that other group in a little while if I have no luck here.

No worries. Best of luck.

Jim
--
http://www.ursaMinorBeta.co.uk http://twitter.com/GreyAreaUK

"Get over here. Now. Might be advisable to wear brown trousers
and a shirt the colour of blood." Malcolm Tucker, "The Thick of It"
From: Stefan Haller on
R <me32(a)privacy.net> wrote:

> How do I determine which one to include if I end up in another situation
> like the one above?

In cases like this I find the Xcode documentation very helpful. If you
type kCGDirectMainDisplay in the search field of the documentation
window, it takes you to the page "Quartz Display Services Reference"; if
you scroll all the way to the top of that page, it says "Framework:
ApplicationServices/ApplicationServices.h".


--
Stefan Haller
Berlin, Germany
http://www.haller-berlin.de/