[Qt-creator] How to include OS X system framework header files?

Eike Ziller eike.ziller at nokia.com
Fri Apr 9 17:56:09 CEST 2010


On Apr 9, 2010, at 3:23 PM, ext Stephen Chu wrote:

> On 4/9/2010 4:29 AM, Eike Ziller wrote:
>> Hi,
>> 
>> On Apr 7, 2010, at 9:55 PM, ext Stephen Chu wrote:
>> 
>>> Hi.
>>> 
>>> I need to access some native OS X functions, specifically ColorSync API.
>>> I can add #include<ApplicationServices/ApplicationServices.h>  to my
>>> source files and have it compiled properly. But if I use #include
>>> <ColorSync/CMApplication.h>  then it can not find the file.
>> 
>> There is no "ColorSync" framework in the default framework search paths (e.g. /System/Library/Frameworks, /Library/Frameworks).
>> If you include<ApplicationServices/ApplicationServices.h>  you'll get the color sync API as well.
>> 
>> Now, ApplicationServices.h includes "<ColorSync/ColorSync.h>", but this is not available to anyone outside of the ApplicationServices framework. It is a private Framework located inside the ApplicationServices framework itself. That's why you can't include<ColorSync/CMApplication.h>  directly either.
>> 
> 
> Well. CoreGraphics is included in ApplicationServices.h in the same 
> fashion

Yeah, obviously this is some special handling for this kind of frameworks in frameworks.
The ApplicationServices framework seems to be what is called an "umbrella framework" in Mac-speak [1].

> and Qt's own sources include CoreGraphics/CoreGraphics.h a lot. 
> Don't know how it's able to compile.

Sort of. QtWebkit does. The rest of Qt doesn't (it includes ApplicationServices.h).
I have no idea how they do it, probably some black magic :)
(I can't even find out how they link to the ApplicationServices framework)

>>> What is the rules of including this kind of system headers?
>> 
>> Usually<Foo/Bar.h>  looks for a framework Foo.framework in the framework search paths,
>> and for a header Foo.framwork/Headers/Bar.h.
>> Looks like there are additional rules for frameworks in frameworks that we didn't implement in Qt Creator
>> (ApplicationServices.framework/Frameworks is *not* in the usual framework search path...)
>> So, you should get the types for the ColorSync manager by including<ApplicationServices/ApplicationServices.h>,
>> but you don't which is bug http://bugreports.qt.nokia.com/browse/QTCREATORBUG-1102
>> just created for your convenience :)
> 
> Thank you very much. It bugs me when I see those wiggle lines in the 
> code. :)
> 
> -- 
> Stephen Chu
> <mailto:stephen at ju-ju.com>
> <http://www.ju-ju.com>
> _______________________________________________
> Qt-creator mailing list
> Qt-creator at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-creator


[1] Trying to link against CoreGraphics directly results in "ld: cannot link directly with /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/CoreGraphics.framework/CoreGraphics.  Link against the umbrella framework 'ApplicationServices.framework' instead."

see also http://developer.apple.com/Mac/library/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html

-- 
Eike Ziller
Software Engineer
Nokia, Qt Development Frameworks

Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori







More information about the Qt-creator-old mailing list