Apple Currency Converter Tutorial - parse errors

Discussion in 'Mac Programming' started by geekindisguise, Jul 12, 2009.

  1. macrumors 6502

    geekindisguise

    Joined:
    Jul 22, 2008
    Location:
    Oklahoma
    #1
    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.

    Code:
    #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
    Code:
    @implementation Converter
    Then the second error: parse error before '{' token
    Code:
    - (float)convertCurrency { 
    Then one more error on the Converter.h file

    Code:
    #import <Cocoa/Cocoa.h>
    @interface Converter : NSObject {
        float sourceCurrencyAmount, rate;
    }
    @property(readwrite) float sourceCurrencyAmount, rate;
    
    - (float)convertCurrency;
    
    The error: parse error before '@' token
    Code:
    @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:
     
  2. macrumors 6502

    Joined:
    Jan 3, 2009
    #2
    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.
     
  3. macrumors 6502a

    Joined:
    Oct 29, 2006
    Location:
    Virginia
    #3
    @properties and the 'dot' notation are Objective-C 2.0 features.

    Those are not available on 10.4.x (Tiger)
     
  4. thread starter macrumors 6502

    geekindisguise

    Joined:
    Jul 22, 2008
    Location:
    Oklahoma
    #4
    I did post the Complete code.
    That is all that is in the converter.h and converter.m files.
     
  5. Guest

    Darkroom

    Joined:
    Dec 15, 2006
    Location:
    Montréal, Canada
    #5
    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?
     
  6. macrumors 6502

    Cinder6

    Joined:
    Jul 9, 2009
    #6
    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.
     

Share This Page