Search code examples
c++macoscore-text

osx coretext header for cpp files, pre-10.8?


It looks like before 10.8, CoreText was not a separate framework but was part of Cocoa.

I'm porting a bit of C++ code that wants to use CoreText types such as CTFontRef. When I

#include <CoreText/CoreText.h>

I get a preprocessor error "CoreText/CoreText.h" not found. If I switch to something like

#import <Foundation/Foundation.h>

That works for .m or .mm, but not for .cpp files, since that includes Obj-C code.

Does anyone know what include to use for this case?


Solution

  • Use this include and you should be all set:

    #include <ApplicationServices/ApplicationServices.h>
    

    You may also need to include the "ApplicationServices" framework in your project as well.