PDA

View Full Version : Apple Currency Converter Tutorial - parse errors




geekindisguise
Jul 12, 2009, 10:29 PM
I have followed this tutorial several times trying to figure out what was making it come up with the parse error, but I just keep having the same errors.

On the Converter.m file there are two errors.

#import "Converter.h"

@implementation Converter
@synthesize sourceCurrencyAmount, rate;

- (float)convertCurrency {
return self.sourceCurrencyAmount * self.rate;
}

@end

The first error: parse error before 'AT_NAME' token
@implementation Converter

Then the second error: parse error before '{' token
- (float)convertCurrency {

Then one more error on the Converter.h file

#import <Cocoa/Cocoa.h>
@interface Converter : NSObject {
float sourceCurrencyAmount, rate;
}
@property(readwrite) float sourceCurrencyAmount, rate;

- (float)convertCurrency;


The error: parse error before '@' token
@property(readwrite) float sourceCurrencyAmount, rate;

I copied the codes straight from Apples Tutorial.
Also, I am running OS X 10.4.11 and Xcode 2.5

All help is greatly appreciated.

And if you know of any great online tutorials or anything that would help me learn Cocoa, that would be great. Coming from being a web developer, I thought learning Cocoa would be easy. Lots of it is similar to PHP, but its still very confusing for me. Thanks! :apple:



mdeh
Jul 12, 2009, 10:38 PM
I suggest you post the **complete** code, especially your Converter.h file. I think you will find someone will be able to figure it out.

eddietr
Jul 12, 2009, 11:13 PM
@properties and the 'dot' notation are Objective-C 2.0 features.

Those are not available on 10.4.x (Tiger)

geekindisguise
Jul 13, 2009, 04:47 PM
I suggest you post the **complete** code, especially your Converter.h file. I think you will find someone will be able to figure it out.

I did post the Complete code.
That is all that is in the converter.h and converter.m files.

Darkroom
Jul 13, 2009, 11:14 PM
@properties and the 'dot' notation are Objective-C 2.0 features.

Those are not available on 10.4.x (Tiger)

really? i never knew this... it's strange, though, isn't it? hasn't Objective-C 2.0 been around since 2007ish? why is it not supported on tiger?

Cinder6
Jul 14, 2009, 02:41 AM
really? i never knew this... it's strange, though, isn't it? hasn't Objective-C 2.0 been around since 2007ish? why is it not supported on tiger?

It was added for Leopard. An incentive for developers to upgrade, I guess. Annoying, because it means things like properties, fast enumeration, and the garbage collector break the programs for Tiger.