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

 
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 []
 
angevoyageur:

Only the first dimension can be dynamic []

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

D

 

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.

 

You can only use numbers or predefined constants

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

Yes, it does. What is your error message?
 
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

 
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];
  }
 
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 !

 

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!

Reason: