Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Hot Sauce79

macrumors newbie
Original poster
Jul 1, 2008
22
0
Here is the error that is given.

Undefined symbols:
".objc_class_name_PlacardView", referenced from:
literal-pointer@__OBJC@__cls_refs@PlacardView in MoveMe2View.o
ld: symbol(s) not found
collect2: ld returned 1 exit status


Here is the code (MoveMe2View.m) that contains the error.

#import "MoveMe2View.h"
#import "PlacardView.h"

@implementation MoveMe2View
@synthesize placardView;

- (id)initWithCoder: (NSCoder *)coder {
if (self = [self initWithCoder:coder]) {
[self setUpPlacardView];
}
return self;
}

- (void)setUpPlacardView {

PlacardView *aView = [[PlacardView alloc] init]; //I tracked the error
self.placardView = aView; //down to these three
[aView release]; //lines of code

placardView.center = self.center;
[self addSubview: placardView];
}


- (void)dealloc {
[placardView release];
[super dealloc];
}

@end

Here is the PlacardView.h

#import <UIKit/UIKit.h>


@interface PlacardView : UIView {
UIImage *placardImage;
}
@property (nonatomic, retain) UIImage *placardImage;
@end



Any and all help will be greatly appreciated. Thank you.
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
Where's the implementation of PlacardView? You included the header file, but not the source that contains the actual definitions.

-Lee
 

Hot Sauce79

macrumors newbie
Original poster
Jul 1, 2008
22
0
here is the implementation and the whole PlacardView.m

#import "PlacardView.h"


@implementation PlacardView
@synthesize placardImage;

- (id)init {
UIImage *image = [UIImage imageNamed:mad:"Placard.png"];
CGRect frame = CGRectMake(0, 0, image.size.width, image.size.height);

if (self = [super initWithFrame:frame]) {
self.opaque = NO;
placardImage = image;
}
return self;
}


- (void)dealloc {
[placardImage release];
[super dealloc];
}


- (void)drawRect: (CGRect)rect {
// Drawing code
[placardImage drawAtPoint: (CGPointMake(0.0,0.0))];

}

Also here is the MoveMe2View.h code

#import <UIKit/UIKit.h>

@class PlacardView;

@interface MoveMe2View : UIView {
PlacardView *placardView;
}
@property (nonatomic, retain) PlacardView *placardView;

- (void)setUpPlacardView;

@end
 

Hot Sauce79

macrumors newbie
Original poster
Jul 1, 2008
22
0
I figured out what was wrong. When i added the file I had forgotten to click on the check box for the compiler to know its ready to be compiled. I also had to run the Clean function under the Build section in the menu. Everything works now.
 

ecume

macrumors newbie
Sep 16, 2003
9
0
that error just means that the compiler can't find that class or object. You probably need to add a framework...
 

Soulstorm

macrumors 68000
Feb 1, 2005
1,887
1
That has happened to me a lot of times. That error is caused when the compiler can't find a class or function. Besides the obvious reasons for that to happen, you should also do something like this:

On the left of the Xcode window go to the targets, and find your application. Open it. You should see a build phase named "Compile Sources". Make sure that your implementation file is included inside that build phase. If not, drag and drop it onto that build phase.

Also, make sure that you have all frameworks included and linked to your application! To make that sure, go into your application target again, and see the "Link Binary With Libraries" build phase. See if all necessary .framework files are in there. If not, add them using drag and drop.

I hope this solves your problem.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.