1

My code looks like down this:

-(void)touchBegan:(HWPoint *)point { switch (self.states) { case HWDrawState: HWShape *shape = [[HWShapeManager sharedInstance] addShapeWithType:_shapeClass]; break; case HWSelectState: break; case HWDeleteState: break; default: break; } } 

Why is there a problem with HWShape.... ? I got an error with it:

"error: expected expression before 'HWShape'".

Why is that? Thank you very much for replys.

1
  • states sounds like it is an integer with multiple bit-flags. case does only mask if states is exactly equal to one of the enum values. Commented Nov 30, 2009 at 10:37

1 Answer 1

6

Enclose the definition in brackets:

case HWDrawState: { HWShape *shape = [[HWShapeManager sharedInstance] addShapeWithType:_shapeClass]; } break; case ... 
Sign up to request clarification or add additional context in comments.

1 Comment

This has been explained there: stackoverflow.com/questions/92396/…

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.