MT5 Problem when including enumeration after build 2170

To add comments, please log in or register
rpcastro1979
20
rpcastro1979  

Hi, after build 2170 my code is not compiling anymore.

I am getting erros on the usage on enumeration, it is not recognizing an include of a custom enumeration.


Example:

//+------------------------------------------------------------------+

//|   ClassA                                                      |

//+------------------------------------------------------------------+

class ClassA

  {

private:

public: 

   enum ENUM_TEST {TESTA,TESTB}; // List of structure type



   void              ClassA(void){};

   void             ~ClassA(void){};           // Destructor

  };


//+------------------------------------------------------------------+

//|   ClassB                                                         |

//+------------------------------------------------------------------+

#include <ClassA.mqh>

class ClassB

  {

private:

   ENUM_TEST            test;               // Default category

public:

   void              ClassB(void) {};

   void             ~ClassB(void) {};          // Destructor

  };


Compilation ERROR:

'ENUM_TEST' - unexpected token, probably type is missing? ClassB.mqh 8 4


Tks.

Sergey Golubev
Moderator
112951
Sergey Golubev  

Forum on trading, automated trading systems and testing trading strategies

When you post code please use the CODE button (Alt-S)!

Use the CODE button


Ehsan Tarakemeh
1333
Ehsan Tarakemeh  
rpcastro1979:

Hi, after build 2170 my code is not compiling anymore.

I am getting erros on the usage on enumeration, it is not recognizing an include of a custom enumeration.




 ENUM_TEST have been defined in the scope of ClassA. If you want to access it globally put it outside of the class. 

William Roeder
19843
William Roeder  
  1. MT5 now has proper scoping
              New MetaTrader 5 platform build 2170: MQL5 scope, global Strategy Tester and built-in Virtual Hosting updates - Trading Strategies That Work - General - MQL5 programming forum

    Either do as Ehsan suggests, or use proper scoping

    class ClassB{
     private:
       ClassA::ENUM_TEST            test;               // Default category

  2. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor

rpcastro1979
20
rpcastro1979  
William Roeder:
  1. MT5 now has proper scoping
              New MetaTrader 5 platform build 2170: MQL5 scope, global Strategy Tester and built-in Virtual Hosting updates - Trading Strategies That Work - General - MQL5 programming forum

    Either do as Ehsan suggests, or use proper scoping

  2. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum
              Messages Editor


Thank you very much guys.

To add comments, please log in or register