MT4 Compilation


Hi guys.

I've been using an EA that's composed of an MQ4 file and several includes. Sorry I can't share the code here.

This code came to me "as is". Several of the include files don't compile on their own. They can't find some variables and get compilation errors.

But when I compile the FULL thing, it looks like it doesn't matter all that much, 'cause it goes through. I get an executable and *some* of the functionality that's on the include files.

But some stuff is broken. I've tried moving functions from the include files to the main EA file, and the functions *seem* to get the context they're missing.

They're now compiling on their own without errors. But I'm left with a very uneasy feeling around the incluldes, and how it managed to compile all together without errors before (how do I know it's not doing the same thing now? Can I detect it and prevent it?). My *guess* is that at some point one include file was broken, and from then on no newer machine code was produced from that include file anymore. But how is it compiling the whole thing then? Can I even *add* code to this?

Can you shed some light into how this was compiling even though the individual files did not compile by themselves?

Ex Ovo Omnia
Ex Ovo Omnia  

Many of my mqh files do not compile alone. It is not a requirement, though it might be a good practice. But sometimes it cannot compile, when it relies on the environment, which it loads into. Most of my mqh "compile" attempts end in a picture like that, because the "main" is defined in the topmost file.



When I'm compiling .mqh files that are not located within an MT4 installation, the .mqh will not compile by itself AND the compiler thinks it is MQL5.

The only way to compile it is to compile an indicator located in the same folder that references the .mqh file.

It's been that way for a while.