Conditional compilation for include ?

 

Is there a way method A would work ? 

(to include a library if its not included already if it is required)

#property version   "1.00"
#property strict
#include <Canvas\Canvas.mqh>
//A :
#ifdef CCanvas
string message_from_a="CANVAS IS INCLUDED";
#endif
#ifndef CCanvas
string message_from_a="CANVAS SHOULD BE INCLUDED";
#endif
//B : 
#ifdef XRGB
string message_from_b="CANVAS IS INCLUDED";
#endif 
#ifndef XRGB
string message_from_b="CANVAS SHOULD BE INCLUDED";
#endif
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
  Alert("Message from A : "+message_from_a+"\nMessage from B : "+message_from_b);
  return(INIT_SUCCEEDED);
  }

void OnTick(){}

Thanks 

 
  1. Lorentzos Roussos: Is there a way method A would work ?
    Add a #define CCanvas . either in the include or just after the #include.
    #include <Canvas\Canvas.mqh>
    #define CCanvas .
    //A :
    #ifdef CCanvas
        string message_from_a="CANVAS IS INCLUDED";
    #else
        string message_from_a="CANVAS SHOULD BE INCLUDED";
    #endif
  2. Lorentzos Roussos: (to include a library if its not included already if it is required)
    Just include it if you use something from it.
 
William Roeder:
  1. Add a #define CCanvas . either in the include or just after the #include.
  2. Just include it if you use something from it.

Thanks

Reason: