type name does not allow storage class to be specified

Viewed 7703
@interface Foo : NSObject

{
    extern int gGlobalVar;   
    int i;
}
-(void)setgGlobalVar:(int)val;

@end


@implementation Foo

-(void)setgGlobalVar:(int)val
{  
    i = 5;
    NSLog(@"i = %i", i);
    gGlobalVar = val;
}

@end

I can declare i in interface and use it in implementation without any errors. But I cannot declare a variable of the type extern in interface. Why is this so? Why do I get an error which says that: "Type name does not allow storage class to be specified"?

1 Answers
Related