gooly: Function definition - what is wrong?
int getInt2Index(int i0, int& arr[][]){ | Only the first dimension can be variable. |
gooly: Function definition - what is wrong? | Only the first dimension can be variable. |
#property indicator_chart_window #property strict int getInt2Index(int i0, int& arr[][]) { int ret = ArraySize(arr) > 0 ? arr[0][0] : -1; Comment("Hello array[0][0]=", ret); return ret; } int OnInit() { int ret = INIT_SUCCEEDED; int dataArr[1][2]; dataArr[0][0] = 25; getInt2Index(20, dataArr); return ret; } int OnCalculate( const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { return rates_total; }
gooly: Function definition - what is wrong? | Only the first dimension can be variable. |
1.) It is the definition of a function with a 2-dim array defined else where.
2.) Don't compile an EA, script or indicator, compile a mqh-file.
Now I am facing something really new??
My original file causes the compiler error. I wanted to create a new mqh-file with this function - which compiles with no error??
I copied from the beginning till that function from the 'error-mqh' into the 'new-mqh' and eliminated some function that need others it compiles again with no error?
Ok I repeat this trick with renaming the old error-mqh and creating a new mqh with the original name and copied everything (ctrl-A, ctrl-C) from the error-mqh into the new mqh (Ctrl-A,Ctrl-V) and now it compiles with no error??
But another mqh-file that calls my now perfectly compiling new-mqh-file still throws the above mentioned error?? Ok needed to reaped the procedure and now it works.
Hmm - hard to understand!
Looks a bit like an IKEA wardrobe after some time they have to renewed.
1.) It is the definition of a function with a 2-dim array defined else where.
2.) Don't compile an EA, script or indicator, compile a mqh-file.
Again, I have no problem compiling this in mqh file and then including that elsewhere
Very odd
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Function definition - what is wrong?
causes '[' - invalid index value Defines.mqh 581 36
Char 36 is the 2nd [
Even a
causes a ',' - invalid index value Defines.mqh 581 35