Can't compile code when working with CALayer
Asked Answered
L

1

43

For some reason I get linker errors when I try and use CALayer:

  "_OBJC_CLASS_$_CALayer", referenced from:

I have imported the following headers:

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>

Code:

arrowImage = [[CALayer alloc] init];
Lazes answered 3/6, 2010 at 16:53 Comment(1)
Did you also add the QuartzCore.framework to your target?Keli
P
80

Make sure you also add the QuartzCore framework to your target. Just importing the header isn't enough.

XCode Screenshot enter image description here

Pyelitis answered 3/6, 2010 at 17:0 Comment(3)
If you dont know how to do this: * right-click on you project in the Groups & Files window (on the left) * click add -> existing frameworks * select QuartzCore.framework & click AddSlaughterhouse
Update for XCode 4: to do this, click your project in the project navigator, in the summary tab, scroll down to Linked Frameworks, and add it there. You'll have to organize the added framework in your project navigator afterwards. :)Derail
or just @import QuartzCore;, if you are using the new Objective-C module support.Capitalistic

© 2022 - 2024 — McMap. All rights reserved.