Compile error on action for iPhone app: "error:expected ')' before ';' token"

iphone, objective-c

Solution

Ah I figured it out. The error was in a completely different section. Figures. :)

I wrote "#define kShowSegmentIndex 0;" instead of "#define kShowSegmentIndex 0". Apparently I should have left off the semicolon.

Thanks for the help.

Problem

I'm working through the tutorials in the "Beginning iPhone Development" book. I'm on chapter 4 and I'm getting the following compile error on the "if (segment == kShowSegmentIndex)" line: ``` error:expected ')' before ';' token ``` Here's my code: ``` - (IBAction)toggleShowHide:(id)sender{ UISegmentedControl *segmentedControl = (UISegmentedControl *)sender; NSInteger segment = segmentedControl.selectedSegmentIndex; if (segment == kShowSegmentIndex) [switchView setHidden:NO]; else [switchView setHidden:YES]; } ``` I've compared it with the code in the book several times and have retyped it. Sounds like this error is caused by improper brace placement. Any thoughts?

Original source