### Author Topic: DIM  (Read 2909 times)

#### roberto

• Guest
##### DIM
« on: 2016-Dec-11 »
Code: (glbasic) [Select]
`// Project: PioggiaDiMario// Start: Monday, December 05, 2016// IDE Version: 14.001// FREE-VERSION:// Need Premium for Features:// 3D Graphics// Network Commands// INLINE C/C+++ codeLOCAL a\$GLOBAL b\$, n1, n2, n3, postodata//GLOBAL barig\$, cagliarig\$, firenzeg\$, genovag\$, milanog\$, napolig\$, palermog\$, romag\$, torinog\$, veneziag\$//DIM   pos[6]//DIM   riga\$[811]DIM   postodata[9]postodata[0]=0postodata[1] = -30postodata[2] = -29postodata[3] = 1postodata[4] = 31postodata[5] = 30postodata[6] = 29postodata[7] = -1postodata[8] = -31 n1 = 32 n2 = 90 n3 = 3//La formula per trovare la posizione è n1+n2*x+3(y-z), 32+90*5+3(54-51)=491//dove x è la parte intera del numero diviso 10,//y è il numero e z è x per 10 +1menu (a\$)SHOWSCREENMOUSEWAIT//MENUFUNCTION menu: a\$PRINT "MENU",110,10PRINT "1. INSERIMENTO NUMERI USCITI", 10,20PRINT "2. SCELTA RUOTA DA STAMPARE", 10,30PRINT "3. STAMPA ELENCO RUOTE GIOCABILI IN ORDINE DA 10 A MENO NUMERI", 10,40PRINT "4. SELEZIONA RUOTA PER STAMPA NUMERI GIOCABILI", 10,50PRINT "5. VINCITE O PERDITE COMPLESSIVE PUNTANDO 1 EURO", 10,60INPUT a\$, 10,70IF a\$ = 1 THEN GOSUB ruoteENDFUNCTIONSUB ruote:PRINT "1. BARI",10,20; PRINT "2. CAGLIARI",10,30; PRINT "3. FIRENZE",10,40; PRINT "4. GENOVA",10,50; PRINT "5. MILANO",10,60; PRINT "6. NAPOLI",10,70; PRINT "7. PALERMO",10,80; PRINT "8. ROMA",10,90; PRINT "9. TORINO",10,100; PRINT "10. VENEZIA",10,110INPUT  b\$, 10,120//IF  b\$=1 THEN GOSUB bariENDSUB*** Configuration: WIN32 ***precompiling:GPC - GLBasic Precompiler V.10.037 SN:ea8f9b97 - 2D, WIN32Wordcount:37 commandscompiling:C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:77: error: no matching function for call to `DIM(DGInt&, int)'Q:/Compiler/platform/Include/glb.h:916: note: candidates are: void __GLBASIC__::DIM(__GLBASIC__::DGIntArray&, DGNat, DGNat, DGNat, DGNat)Q:/Compiler/platform/Include/glb.h:917: note:                 void __GLBASIC__::DIM(__GLBASIC__::DGNatArray&, DGNat, DGNat, DGNat, DGNat)C:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:81: error: `__GLBASIC__::postodata' cannot be used as a functionC:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:85: error: `__GLBASIC__::postodata' cannot be used as a functionC:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:89: error: `__GLBASIC__::postodata' cannot be used as a functionC:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:93: error: `__GLBASIC__::postodata' cannot be used as a functionC:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:97: error: `__GLBASIC__::postodata' cannot be used as a functionC:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:101: error: `__GLBASIC__::postodata' cannot be used as a functionC:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:105: error: `__GLBASIC__::postodata' cannot be used as a functionC:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:109: error: `__GLBASIC__::postodata' cannot be used as a functionC:\Users\gabriele\AppData\Local\Temp\glbasic\gpc_temp0.cpp:113: error: `__GLBASIC__::postodata' cannot be used as a function`
why?
« Last Edit: 2016-Dec-12 by spacefractal »

#### Qedo

• Dr. Type
• Posts: 271
• to program what I have todo how should I program?
##### Re: DIM
« Reply #1 on: 2016-Dec-11 »
GLOBAL b\$, n1, n2, n3, postodata[]

Ciao
Qedo

#### Moru

• Prof. Inline
• Posts: 1792
##### Re: DIM
« Reply #2 on: 2016-Dec-12 »
Hello!

This is due to setting up postodata as a variable. You need to set it up as an array. Yes, the error message could be more helpful :-) I have been banging my head against the wall a number of times because of this little thing until I finaly figured it out.

The line:
GLOBAL b\$, n1, n2, n3, postodata

Needs to be changed to:
GLOBAL b\$, n1, n2, n3, postodata[]

This prepares GLBasic for treating postodata[] as an array.

#### Schranz0r

• Premium User :)
• Prof. Inline
• Posts: 5074
• O Rly?
##### Re: DIM
« Reply #3 on: 2016-Dec-12 »
Qedo and Moru got it!
I DGArray's

PC:
AMD Ryzen 7 1700 @3.9GHz, 16GB HyperX Fury 3000MHz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

#### spacefractal

• Community Developer
• Prof. Inline
• Posts: 3929
##### Re: DIM
« Reply #4 on: 2016-Dec-12 »
This is just a code bug.

But in the end, the glbasic parser should catch this kind of error in runtime in the ide, when a array on a DIM is not found?

Can been quite annoying with this kind of bugs and confucsion.
Genius.Greedy Mouse - Karma Miwa - Spot Race - CatchOut - PowerUp Elevation and The beagle Jam.

#### Schranz0r

• Premium User :)
• Prof. Inline
• Posts: 5074
• O Rly?
##### Re: DIM
« Reply #5 on: 2016-Dec-13 »
the debug says all you need:

no matching function for call to `DIM(DGInt&, int)'

Trying to Dim an Int is a bad idea
Should be DGIntArray.
I DGArray's

PC:
AMD Ryzen 7 1700 @3.9GHz, 16GB HyperX Fury 3000MHz Ram, ASUS ROG GTX 1060 STRIX 6GB, Windows 10 Pro 64Bit, MSi Tomahawk B350 Mainboard

#### UBERmonkeybot

• Mr. Polyvector
• Posts: 243
##### Re: DIM
« Reply #6 on: 2016-Dec-14 »
err that's ok then