Download MetaTrader 5

What does "ambigouos call to overloaded function with same parameters" mean, in english?

To add comments, please log in or register
HarriMQL5
350
HarriMQL5  
Pre-600 code generating this error on compilation. What doesnt the new MQL4 compiler not like?
Ex Ovo Omnia
3188
Ex Ovo Omnia  
HarriMQL4:
Pre-600 code generating this error on compilation. What doesnt the new MQL4 compiler not like?


You have the function twice in your code. Duplicate function name would not compile in the pre-600 code, so it is definitively not original pre-600 code. In 600+ it is possible, but the signature must be unique, unlike the example:

void test() {}
void test(string s = "") {}

void start() {
   test();   // which test() to pick out?
}
Carl Schreiber
6692
Carl Schreiber  
HarriMQL4:
Pre-600 code generating this error on compilation. What doesnt the new MQL4 compiler not like?

As the compiler cannot clearly distinguish between your function calls. Please show all the code lines of the ambiguous function: definition and use.

HarriMQL5
350
HarriMQL5  
Ovo:


You have the function twice in your code. Duplicate function name would not compile in the pre-600 code, so it is definitively not original pre-600 code. In 600+ it is possible, but the signature must be unique, unlike the example:

The functions are definitely NOT defined twice in the code, because the pre-600 compiler would not accept it. To use your example to illustrate how the code looks:

void test(string s = "") {}

void start() {
   test();                         // Valid
   test("function with argument"); //Also valid
}
Pre-600: both calls to test are valid, since function test has 1 optional argument.
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
void test(string s = "") {}

void start() {
   if(a==b)test();                         // Valid
   else {test("function with argument");} //Also valid
}

How bout something like that?
Carl Schreiber
6692
Carl Schreiber  
HarriMQL4:

The functions are definitely NOT defined twice in the code, because the pre-600 compiler would not accept it. To use your example to illustrate how the code looks:

Pre-600: both calls to test are valid, since function test has 1 optional argument.

I doubt that your example causes the compiler to warn you! There is no overload of parameters.

Overload means that you defined test twice once like void test(int=0){} and once like test(double=0.0){}

HarriMQL5
350
HarriMQL5  
gooly:

I doubt that your example causes the compiler to warn you! There is no overload of parameters.

Overload means that you defined test twice once like void test(int=0){} and once like test(double=0.0){}

Here's the thing: If I defined a function twice, build 509 compiler would complain. It doesnt. There is no code change, the only change is the upgrade from build 509 to build 600. As soon as MT drops me in the new Metaeditor I hit the "compile" button and bang! I get those sort of errors.

What code changes does the upgrade make to existing files? I know Metaquotes state there are none, but Im begining to doubt that.

UPDATE:

I think I have tracked down the problem. It has to do with header files (.mqh) that either contain function declarations (which then need a separate library file - .mq4 - to define a function), or complete function definitions which can be included in the EA code. I had one header file (A.mqh) for a library (A.mq4) that declared functions but were then not implemented (defined) in the library, but also different header file (B.mqh) that just acted as inline replacement in the code; but B.mqh had the only definitions of the functions.

Carl Schreiber
6692
Carl Schreiber  
HarriMQL4:

Here's the thing: If I defined a function twice, build 509 compiler would complain. It doesnt. There is no code change, the only change is the upgrade from build 509 to build 600. As soon as MT drops me in the new Metaeditor I hit the "compile" button and bang! I get those sort of errors.

What code changes does the upgrade make to existing files? I know Metaquotes state there are none, but Im begining to doubt that.




First what you get is a warning not an error - and the 'policy of warning' has changed!

Second without the code that causes the warning I can't say anything more.

HarriMQL5
350
HarriMQL5  
gooly:

First what you get is a warning not an error - and the 'policy of warning' has changed!

Second without the code that causes the warning I can't say anything more.


Please see update above. Ive removed undefined functions from the header and 600+ compiler is happy now. I will continue to develop on 509 build for time being. Thanks for advice and help!
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI  
HarriMQL4:
I will continue to develop on 509 build for time being. Thanks for advice and help!


Please dont waste your time continuing using 509 because eventually you will have to use 625 and by the time you are there, people already way beyond your knowledge and you are struggling to get things work.

Start using 625 now and you will save a lot of time and effort.

HarriMQL5
350
HarriMQL5  
deysmacro:

Please dont waste your time continuing using 509 because eventually you will have to use 625 and by the time you are there, people already way beyond your knowledge and you are struggling to get things work.

Start using 625 now and you will save a lot of time and effort.

I dont remember asking your opinion. I'll repeat myself: "I will continue to develop on 509 build for time being". Means I know I will eventually move on to 600+, but it will done on my schedule, since I have a stackload of existing libraries, scripts. Since I dont develop for others, thats fine by me.
12
To add comments, please log in or register