PDA

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




andreab35
Jan 14, 2009, 08:13 PM
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!



walty
Jan 14, 2009, 09:44 PM
- (void) applicationDidFinishLaunching:(GSEventRef)event;


u need to add the minus sign to show it is a instance method (instead of class method)

andreab35
Jan 15, 2009, 03:43 AM
- (void) applicationDidFinishLaunching:(GSEventRef)event;


u need to add the minus sign to show it is a instance method (instead of class method)

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.

jnic
Jan 15, 2009, 04:35 AM
That's it. These errors are occurring in the Classes .m file.

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

- (void) applicationDidFinishLaunching:(GSEventRef)event {
// Your code.
}

Maybe try a few tutorials first?

andreab35
Jan 15, 2009, 02:59 PM
- (void) applicationDidFinishLaunching:(GSEventRef)event {
// Your code.
}

Maybe try a few tutorials first?

*sigh*

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

But thanks for helping me. I appreciate your effort.

jeremy.king
Jan 15, 2009, 03:54 PM
post the full .h and .m files