Error: syntax error before 'void' . What am I doing wrong?

Discussion in 'iOS Programming' started by andreab35, Jan 14, 2009.

  1. macrumors 6502a

    andreab35

    Joined:
    May 29, 2008
    Location:
    USA
    #1
    Hi guys!

    Alright, I'm doing better bit by bit at this iPhone development thing! I'm still definitely learning, but I'm just playing around here for now with XCode, seeing what I can basically do.

    Here's a line of code that is preventing me from running a simple little app I made for the heck of it and for playing around with.

    (void) applicationDidFinishLaunching:(GSEventRef)event;

    Right below that is that darn little failed x that says,
    "Error: syntax error before 'void'.

    Is there something wrong with that simple code above, or is the error referring to something else in my little app?

    The code I pasted above does not have anything above it, besides:

    #import "Take2Appdelegate.h"

    #define MAX_FRAMES 45

    That's it. These errors are occurring in the Classes .m file.

    If you could help me out here, I'd really appreciate that! I've tried figuring it out myself, but I'm stumped.

    Thank you!
     
  2. macrumors member

    Joined:
    Jul 15, 2008
    #2
    - (void) applicationDidFinishLaunching:(GSEventRef)event;


    u need to add the minus sign to show it is a instance method (instead of class method)
     
  3. thread starter macrumors 6502a

    andreab35

    Joined:
    May 29, 2008
    Location:
    USA
    #3
    Thank you for your response.

    I added the minus sign like you did above, and now I get the errors:

    warning: declaration does not declare anything
    error: syntax error before '-' token


    Those are the only two errors I get throughout for the whole application.

    But, if the minus sign is taken away, both those errors go away and the error that comes back again that I mentioned in my original post.
     
  4. macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #4
    Code:
    - (void) applicationDidFinishLaunching:(GSEventRef)event {
    	// Your code.
    }
    Maybe try a few tutorials first?
     
  5. thread starter macrumors 6502a

    andreab35

    Joined:
    May 29, 2008
    Location:
    USA
    #5
    *sigh*

    I tried what you did, and I got the same error.
    :(

    But thanks for helping me. I appreciate your effort.
     
  6. macrumors 603

    jeremy.king

    Joined:
    Jul 23, 2002
    Location:
    Fuquay Varina, NC

Share This Page