error when defining arrays

Previous topic - Next topic

phaelax

I just downloaded GLBasic yesterday and thought I'd test it's speed by porting a fire routine over. However, I can't seem to define any arrays. Even copying code from the samples gives me the same error:

"untitled.gbas"(21) error : variable is not explicitly defined : fire

DIM fire[320][240]

So what's wrong? Isn't that statement defining the array variable?

Ian Price

This is all down to the "Explicit Declarations" being set to ON by default. This means that all variables have to be defined before they are accessed/used and prevents spelling errors etc. in your code. You can Turn this off in the Project Options tab.

Or you can add -

Code (glbasic) Select
GLOBAL fire[]
to the beginning of your code.

:)
I came. I saw. I played.