Download MetaTrader 5
To add comments, please log in or register
Are you accustomed to using the standard library? MQL5 has one!
Nikolay
170
Nikolay 2016.02.24 12:30 

If myIndicator.mq4 includes:

#include "commonInclude.mqh"

#include "include1.mqh" 

#include "include2.mqh" 

and

both include1.mqh and include2.mqh include:

#include "commonInclude.mqh"

// custom code

how many times will commonInclude.mqh be included in the compiled version?

Ovo Cz
2951
Ovo Cz 2016.02.24 16:09  
nikolaygmt:

If myIndicator.mq4 includes:

#include "commonInclude.mqh"

#include "include1.mqh" 

#include "include2.mqh" 

and

both include1.mqh and include2.mqh include:

#include "commonInclude.mqh"

// custom code

how many times will commonInclude.mqh be included in the compiled version?

You may include it as many times as you need it, but only the first appearance is used by the compiler.
Nikolay
170
Nikolay 2016.02.24 17:58  
Thank you Ovo!
whroeder1
13627
whroeder1 2016.02.27 12:43  
//+------------------------------------------------------------------+
//|  9:47 AM 8/8/2015                               basic_types.mqh |
//|                              Copyright © 2015, William H. Roeder |
//+------------------------------------------------------------------+
#ifndef BASIC_TYPES_MQH
#define BASIC_TYPES_MQH
//+------------------------------------------------------------------+
   :
#endif   // BASIC_TYPES_MQH
//+------------------------------------------------------------------+
Or put include guards like C++ and don't assume
/
To add comments, please log in or register