Const help
Const help
- Subject: Const help
- From: Killobit <email@hidden>
- Date: Fri, 29 Oct 2004 07:03:17 -0700
hello
I'm trying to create a constant that can be used in 2 different classes
but the compiler keeps giving me the following error
GokubanView.h:40: error: variable-size type declared outside of any
function
where the line is:
int levelGrid[kGridSizeX][kGridSizeY];
I'm trying to define the constant in a file called globalConstants.h
like so:
#ifndef _globals_
#define _globals_
const int kTileSize = 32;//32
const int kGridSizeX = 19;//19
const int kGridSizeY = 16;//16
const int kNumberOfTiles = 4;//4
#endif
i've tried using
extern const int kGridSize = 19
but the compiler also complains saying something to the effect:
constant declared extern with initial value
basically what i want to be able to do is
in one class do the following:
@interface levelClass : Object
{
int levelData[kGridSizeX][kGridSizeY];
}
@end
and in another file:
GokubanView..m:
- (void)initializeLevel {
int i,j;
for(i = 0; i < kGridSizeX; i++) {
blah blah blah
levelData[i][j] = some value
}
any help would be greatly appreciated,
Eric
<NotACrackDealer> "Hello? Is this the hospital? I think my neighbor is
dead.
Send an ambulance. His address? Uh...69.138.49.252. <click> Hello?"
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden