An Array of structs

John Love <[email protected]>
Newsgroups gmane.comp.macosx.devel
Message-ID <[email protected]>
In my .h file, I have:

typedef struct YearAmt {
	NSString  *year;
	int       amount;
} YearAmt;

extern NSString *testy;
extern YearAmt gTest[];

In the corresponding .m file:

NSString *testy = @"testy";
YearAmt gTest[] = {{testy, 10}  /*, + others */};

I get "Initializer element is not constant. This pertains to the NSString* because if I directly substitute the following, no compile error happens:
YearAmt gTest[] = {{@"testy", 10}

What fundamental pertaining to C or C++ am I not getting?


John Love
Touch the Future! Teach!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.