views:

314

answers:

2

Hi!

In advance: sorry for the noob question but I'm learning Cocoa & Objective-C and I have this problem on which I've been searching for a complete hour. It'll be very nice if someone could find the problem!

Here's my two files: Driver.m

#import "Driver.h"

@implementation Driver

- (int)go:(BOOL)distance {
 if (distance) {
  return 10;
 } else {
  return 5;
 }
}

- (NSString *)firstName {
 return firstName;
}

- (void)setFirstName:(NSString *)name {
 [name retain];
 [firstName release];
 firstName = name;
}

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

@end

And here is the other one: Driver.h

#import <Cocoa/Cocoa.h>

@interface Driver : NSObject {
 NSString *firstName;
}

- (int)go:(int)direction theDistance:(BOOL)distance;
- (NSString *)firstName;
- (void)setFirstName:(NSString *)name;

@end

The problem is happening at the @end line of my implementation of Driver. I tried to clean and build, and I looked up google but did not found any help yet.

Thanks a lot!

+3  A: 

There's a mismatch between

- (int)go:(int)direction theDistance:(BOOL)distance;

and

- (int)go:(BOOL)distance {

It's telling you that you declared the first in the .h file, but never implemented it.

BJ Homer
Ah that explains it all! Thanks!Now I have to find how to fix this!
Tom
Ah I found it! It was pretty simple...
Tom
A: 

You declared methods in your @interface context which were not implemented in your @implementation context. You get a compiler warning for that.

NSResponder