views:

66

answers:

1

Hi guys, I'm trying to create a class with global constants:

//Resources.h
#import <Foundation/Foundation.h>

@interface Resources : NSObject 
{
extern NSString * const MY_CONST;
}
@end 

and

//Resources.m
#import "Resources.h"

@implementation Resources

NSString * const MY_CONST = @"my constant";

@end

And getting this nasty error: expected specifier-qualifier-list before 'extern'

What do I need to do?

Thank you

+3  A: 

put

extern NSString * const MY_CONST;

outside of class interface declaration. MY_CONST is not a class member, so why put it inside?

Vladimir
Ok, thanks, didn't know about that))
Burjua
not so much of an option: it's illegal to put an extern or static variable in an ivar
Jared P
Jared P , I didn't get it, what do u mean?
Burjua