Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Objective-C – Undefined symbols

I'm trying to use a gradient in cocoa touch. I'm using the following code for this:

#import <QuartzCore/QuartzCore.h>

CAGradientLayer *gradient = [CAGradientLayer layer];
gradient.frame = mainView.bounds;
gradient.colors = [NSArray arrayWithObjects:(id)[[UIColor blackColor] CGColor], (id)[[UIColor whiteColor] CGColor], nil];
[mainView.layer insertSublayer:gradient atIndex:0];

But I get the following error when I try to compile:

Undefined symbols for architecture i386:
"_OBJC_CLASS_$_CAGradientLayer", referenced from: objc-class-ref in OfficeViewController.o ld: symbol(s) not found for architecture i386 collect2: ld returned 1 exit status

I've tried to do a clean to no avail. Not really sure what else I can do?

like image 415
Peter Warbo Avatar asked Sep 18 '11 20:09

Peter Warbo


1 Answers

Make sure you actually included the QuartzCore framework in your project. It should be in the Link Binary With Libraries phases:

enter image description here

like image 64
Oscar Del Ben Avatar answered Dec 27 '22 10:12

Oscar Del Ben