objective c - typedef in header causes error "Expected specifier-qualifier-list before 'typedef'" -


dear wisdom of internet,

in header-file (objective-c)

mytestclass.h

#import <foundation/foundation.h>   @interface mytestclass : nsobject {       typedef int pixel;    }   - (id) initwithpic: (nsstring*) picfilename;   - (void) dealloc;   - (void) dosomething;   @end 

at line typedef int pixel;xcode complains like
( ! ) "expected specifier-qualifier-list before 'typedef'" ( 3 )

this err-msg seems pretty popular given solutions (missing #import) not work me. hints found not explain going wrong here.

i not understand err-msg can explain me?

i appreciate tips.

not sure trying do, put should put typedef before interface.

inside braces place ivars.

if want integer variable, not need typedef:

@interface myclass {     int mypixel; } @end 

typedefs used create new type, based on another. instance:

typedef int pixel;  @interface myclass {     pixel mypixel; } @end 

so when use pixelpseudo-type, int type used.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

android - layout with fragment and framelayout replaced by another fragment and framelayout -