Syntax error before 'void'... Why?

Discussion in 'Mac Programming' started by macindev, Jul 6, 2009.

  1. macrumors newbie

    Joined:
    Jul 6, 2009
    Location:
    Seattle, Washington, USA
    #1
    Why am I getting this error message?

    Code:
    - (void)openWindow:(id)IBAction{
        [COLOR="Red"]error: syntax error before 'void'[/COLOR]
     [self.window makeKeyAndOrderFront:self];
    }

    FYI: This is inside the implementation.

    I am trying to make a method for opening a window by selecting a menu item, but I am barely starting to learn Objective-C and I only know HTML...
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Try:
    Code:
    - (IBAction)openWindow:(id)sender {
        [[self window] makeKeyAndOrderFront:nil];
    }
     
  3. thread starter macrumors newbie

    Joined:
    Jul 6, 2009
    Location:
    Seattle, Washington, USA
    #3
    Thanks, I tried that but am now getting a warning saying "'MyDocument' may not respond to '-window'". And, build fails with exit code 1 and says "duplicate symbol .objc_class_name_MyDocument"... :(


    ~ I do not know why this last part is happening, because I tried reverting the code back to a "working" state and I got the same error... strange... ~
     
  4. thread starter macrumors newbie

    Joined:
    Jul 6, 2009
    Location:
    Seattle, Washington, USA
    #4
    Fixed it...

    I finally figured out what was wrong, I made another class for a nib file called "Browser" but the methods were duplicates of what was in "MyDocument" and that was keeping it from building.
    :cool:
     

Share This Page