Having a problem with single dimensioned array

Previous topic - Next topic

AlienMenace

Hello,

I try this code:

GLOBAL enemy_ID
DIM enemy_ID[7]
enemy_ID[1]=1

and receive this result:


*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.7.861 SN:741e258f - 3D, NET
Wordcount:2 commands
compiling:
C:\Users\test\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\Users\test\AppData\Local\Temp\glbasic\gpc_temp0.cpp:49: error: no matching function for call to `DIM(DGInt&, int)'
C:/Coding/GLBasic/Compiler/platform/Include/glb.h:861: note: candidates are: void __GLBASIC__::DIM(__GLBASIC__::DGIntArray&, DGNat, DGNat, DGNat, DGNat)
C:/Coding/GLBasic/Compiler/platform/Include/glb.h:862: note:                 void __GLBASIC__::DIM(__GLBASIC__::DGNatArray&, DGNat, DGNat, DGNat, DGNat)
C:\Users\test\AppData\Local\Temp\glbasic\gpc_temp0.cpp:53: error: `__GLBASIC__::enemy_ID' cannot be used as a function
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 1.1 sec. Time: 00:51
Build: 0 succeeded.
*** 1 FAILED ***

What am I doing wrong?
Thanks.
Apps published: 3

Moru

You declare a variable, not an array I believe

ampos

check my web and/or my blog :D
http://diniplay.blogspot.com (devblog)
http://www.ampostata.org
http://ampostata.blogspot.com
I own PC-Win, MacBook 13", iPhone 3G/3GS/4G and iPAC-WinCE

Ian Price

You missed out the brackets [] after the GLOBAL definition

Code (glbasic) Select

GLOBAL enemy_ID[]

DIM enemy_ID[7]

enemy_ID[1]=1


WHILE TRUE

PRINT enemy_ID[1],10,10

SHOWSCREEN

WEND


This now works fine.
I came. I saw. I played.

AlienMenace

Apps published: 3