1. Welcome to the new MacRumors forums. See our announcement and read our FAQ

Error: expected ';' before '-' token

Discussion in 'Mac Programming' started by alexbates, Jun 10, 2009.

  1. macrumors 65816

    alexbates

    #1
    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....

    Code:
    #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.
     

    Attached Files:

  2. macrumors 6502

    #2
    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
     
  3. macrumors 65816

    alexbates

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

    Code:
    -(IBAction) gotoAddress:(id)sender[B][U];[/U][/B]
    
    in the ViewController.h file before...

    Code:
    @end
    
    It will now build and go successfully...hooray!

    Thanks again,
    Alex
     
  4. macrumors 601

    HiRez

    #4
    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.
     

Share This Page