Compilation Question

 

Hello there,

I've just about completed my first MQ4 OOP application that is triggered by an EA and comprises of various different .mqh files, each containing individual class definitions. So far, I'm just running it locally on a demo account.

I'm unsure as to how the MetaEditor handles compilation? As the EA references/includes the first class (.mqh) that in turn includes other .mqh files, do you only need to compile the EA file and distribute that .ex4 file or, do you need to compile each file involved and distribute them all?

My main Windows experience is with C# and using Visual Studio, the compiler pulls in everything to a single .exe file. Not too sure about MetaEditor so, any advice would be greatly appreciated! :)

Cheers,

--G

 

Included files are as if that code was inserted at that point. You do not compile them.

After compilation, you do not need any source code, the EX4 is all you need.

 
whroeder1:

Included files are as if that code was inserted at that point. You do not compile them.

After compilation, you do not need any source code, the EX4 is all you need.


Thanks for replying. So, everything that is needed is pulled into the EX4 of the EA?

 
Geester:

Thanks for replying. So, everything that is needed is pulled into the EX4 of the EA?


All the code in the mqh files, yes. However, it doesn't include external resources like external indicators, images, sounds, etc. For those to be compiled into the ex4 you need to use #resource.

https://www.mql5.com/en/docs/runtime/resources

Documentation on MQL5: MQL5 programs / Resources
Documentation on MQL5: MQL5 programs / Resources
  • www.mql5.com
//| Calls standard OrderSend() and plays a sound                     | The example shows how to play sounds from files 'Ok.wav' and 'timeout.wav', which are included into the standard terminal package. These files are located in the folder is a folder, from which the MetaTrader 5 Client Terminal is started. The location of the terminal...
 
nicholishen:

All the code in the mqh files, yes. However, it doesn't include external resources like external indicators, images, sounds, etc. For those to be compiled into the ex4 you need to use #resource.

https://www.mql5.com/en/docs/runtime/resources


Cool. That's what I needed to understand. Many thanks :)

Reason: