Author Topic: error when defining arrays  (Read 988 times)

Offline phaelax

  • Mc. Print
  • *
  • Posts: 36
    • View Profile
error when defining arrays
« 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?

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4144
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: error when defining arrays
« Reply #1 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.

:)
I came. I saw. I played.