compilation error?

To add comments, please log in or register
Amir Yacoby
1218
Amir Yacoby  

Is it me or it still seems buggy?
I try to call CDealInfo::Ticket(const ulong ticket) from another class which has an instance variable of CDealInfo;

#include "..\DealInfo.mqh"
class a 
  {
   private:
     CDealInfo deal;
   public:
     void Delegate();
  };
void a::Delegate()
  {
   ulong ticket=123;
   deal.Ticket(ticket);  // here there is a compilation error - Ticket - no one of the overloads can be applied to the function call
  }

And get compilation error as stated.
In addition the compiler says: It can't decide which of two methods void Ticket(const ulong ticket) or void Ticket() - to choose from.

Enrique Dangeroux
408
Enrique Dangeroux  
Amir Yacoby:

Is it me or it still seems buggy?
I try to call CDealInfo::Ticket(const ulong ticket) from another class which has an instance variable of CDealInfo;

And get compilation error as stated.
In addition the compiler says: It can't decide which of two methods void Ticket(const ulong ticket) or void Ticket() - to choose from.


I am no expert by any means, but this

deal.Ticket(deal);

looks like a self reference to me. Can not be good.

Amir Yacoby
1218
Amir Yacoby  
Enrique Dangeroux:

I am no expert by any means, but this

looks like a self reference to me. Can not be good.

you are right, but it is just a tipo. I edited it, should be deal.Ticket(ticket); // - still the error
Amir Yacoby
1218
Amir Yacoby  
with pointer (CDealInfo *m_deal_info) it works fine, but why is that have to be a pointer? 
Anthony Garot
1817
Anthony Garot  
Amir Yacoby:
with pointer (CDealInfo *m_deal_info) it works fine, but why is that have to be a pointer? 

The following compiles fine for me in an MQL5 script.

#include <Trade\DealInfo.mqh>   // <<<< Maybe this?
class a 
  {
   private:
     CDealInfo deal;
   public:
     void Delegate();
  };
void a::Delegate()
  {
   ulong ticket=123;
   deal.Ticket(ticket);
  }

Maybe it's your #include statement. See what I used.

To add comments, please log in or register