Linker can't find CTFontCreateWithNameAndOptions
Asked Answered
I

2

5

I am trying to use CTFontCreateWithNameAndOptions() from CoreText and the linker is saying "Symbol(s) not found", specifically for _CTFontCreateWithNameAndOptions. I added CoreText.framework and am importing <CoreText/CoreText.h>. It compiles fine, but the linker fails.

Here's the declaration in CTFont.h:

CTFontRef CTFontCreateWithNameAndOptions( CFStringRef name, CGFloat size, const CGAffineTransform *matrix, CTFontOptions options ) CT_AVAILABLE_STARTING( __MAC_10_6, __IPHONE_3_2);

Here's the actual call:

CTFontRef font = CTFontCreateWithNameAndOptions( (CFStringRef)@"HelveticaNeue-Bold" , 14.0f , NULL , kCTFontOptionsDefault ) ;

Anybody have any ideas?

My iOS app is linking against the 4.2 framework.

Imaginable answered 11/12, 2010 at 22:18 Comment(1)
Apparently, it might not exist: friendfeed.com/bobtiki/5955ec13/…Imaginable
M
1

I had the same problem. _CTFontCreateWithNameAndOptions is not part of the CoreText framework for iOS, it is part of CoreText framework for OS X only. I reported a documentation bug.

Mccaffrey answered 28/8, 2012 at 8:19 Comment(0)
H
1

You need to add the CoreText.framework to your project.

  1. Go to the project settings
  2. Select the appropriate target
  3. Click Build Phases
  4. Expand Link Binary With Libraries
  5. Click + to add, and find CoreText.Framework, as per screenshot:

Add Core Text

Horgan answered 9/8, 2011 at 20:0 Comment(1)
Nope, I'm fairly sure Apple only put it in the header and it's not in the library... which is why the linker is failingAdventitia
M
1

I had the same problem. _CTFontCreateWithNameAndOptions is not part of the CoreText framework for iOS, it is part of CoreText framework for OS X only. I reported a documentation bug.

Mccaffrey answered 28/8, 2012 at 8:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.