GLBasic forum

Main forum => GLBasic - en => Topic started by: phaelax on 2010-Sep-01

Title: error when defining arrays
Post by: phaelax on 2010-Sep-01
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?
Title: Re: error when defining arrays
Post by: Ian Price on 2010-Sep-01
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.

:)