PDA

View Full Version : Error: expected ';' before '-' token




alexbates
Jun 10, 2009, 09:37 PM
I finally finished coding an iPhone web browser but have gotten this error in Xcode in two different places. And the code the errors are referring to are....


#import "Basic_BrowseAppDelegate.h"
#import "Basic_BrowseViewController.h"


I don't think there is supposed to be a semicolon there buy I may be wrong.

Any ideas? (screenshots of errors are attached)

Thanks to all help! And sorry if this has already been asked or its a stupid question... I'm new to programming.



lucasgladding
Jun 10, 2009, 09:46 PM
You'll get used to these errors in the future. The problems are within your header files but are getting flagged during import in the implementation files. You may be able to spot the problem if you focus your attention there. If you have trouble finding the error, please post the source from those headers and someone should be able to help.

Hint: check your method declarations in the header for trailing semicolons.

Kind regards

Luke

BTW: you're correct - there is no semicolon after the import command

alexbates
Jun 10, 2009, 09:55 PM
You'll get used to these errors in the future. The problems are within your header files but are getting flagged during import in the implementation files. You may be able to spot the problem if you focus your attention there. If you have trouble finding the error, please post the source from those headers and someone should be able to help.

Hint: check your method declarations in the header for trailing semicolons.

Kind regards

Luke

BTW: you're correct - there is no semicolon after the import command

Thanks for your reply. I think I have figured out the error. I was missing the semicolon after...


-(IBAction) gotoAddress:(id)sender;


in the ViewController.h file before...


@end


It will now build and go successfully...hooray!

Thanks again,
Alex

HiRez
Jun 10, 2009, 11:36 PM
Just a general note, when you get errors near the beginning of a file, after you've checked what it's telling you, start looking for missing semicolons and missing or mis-matched braces. A lot of times the compiler will get really confused in these cases and the real error may be far away from where it's telling you it is, and the error it's reporting might not be the real problem either.