Download MetaTrader 5

Declaration of Array Error message from compile MT4build 600 - page 2

To add comments, please log in or register
Alain Verleyen
Moderator
32429
Alain Verleyen  
DanielTahiti:

Hi,

Hi personnaly used that, before resizing with the numbers of pairs selected by the trader :

double atd_AtrMarge[][][][];


and i get the same compiler message :

'[' - invalid index value


???





Only the first dimension can be dynamic []
murger
82
murger  
angevoyageur:

Only the first dimension can be dynamic []

Of course, Thanks, we all this change, beeing paranoic before thouhgt.. Thanks.

D

hossein71
11
hossein71  

hi, i try to define an array like this

int l=4;
double wInput[l];

but i got the same error " [" invalid index value

but when i write this

double wInput[4];

there is no error!

i think we are not allowed to use variables for index in decluration stage, if that is the problem, can anybody give me any solution? thanks.

honest_knave
Moderator
2327
honest_knave  

You can only use numbers or predefined constants

#define l (4)
double wInput[l];
hossein71
11
hossein71  
honest_knave:
it does not work. thanks any way.
honest_knave
Moderator
2327
honest_knave  
hossein71:
it does not work. thanks any way.

Yes, it does. What is your error message?
hossein71
11
hossein71  
honest_knave:

Yes, it does. What is your error message?

i wrote this

#define l (4)
double wInput[l];


and i got these errors

";" unexpected token

'[' unbalanced left paranthesis

']'semicolon expected

'wInput' undeclared identifier

wInput  parameter conversion not allowed

honest_knave
Moderator
2327
honest_knave  
hossein71:

i wrote this


and i got these errors

";" unexpected token

'[' unbalanced left paranthesis

']'semicolon expected

'wInput' undeclared identifier

wInput  parameter conversion not allowed


There must be more lines in your code causing the problem. This compiles without error:

#property strict

void OnStart()
  {
   #define l (4)
   double wInput[l];
  }
hossein71
11
hossein71  
honest_knave:


There must be more lines in your code. This compiles without error:

i wrote it in my own function ( Subroutine) and call it from OnInit()

i wrote it directly in OnInitand these errors disappear

";" unexpected token

'[' unbalanced left paranthesis

']'semicolon expected

but still i got

'wInput' undeclared identifier

'wInput'  parameter conversion not allowed

i don't know why these errors appear! i wrote by several languages like java, c , basic ,matlab but none of them were like this !

honest_knave
Moderator
2327
honest_knave  

Unfortunately, unless you post up your code I can't help you.

As you can see from my example above (and the examples in the documentation) it works. 

Good luck!

123
To add comments, please log in or register