Compiling without using the Editor in MT4 -SOLVED-

 

out there are a lot of very good editors, with a lot of features, more than the build in MQL4 Editor.

it is a bad idea and a lot of work to modify the editor to make it as good as all the others out there.

my suggestion is, to provide the compiler as standalone exe file, this should be easy to establish, or, call the editor with switches like /compile /file=test.mq4

so everyone can use its favourite editor and compile mq4 files directly from the favourite editor.

as mql5 is out now, but it is not liked very much for some reasons from many programmers/traders,

i would be very pleased if the MT4 team makes my suggestion avaiable at MT4 too.

i think MT4 will be used at least until 2012, and i think its not more than some hours to make the compile function avaiable as a standalone exe.


greetings, meikel

 

Just a suggestion but you could have the file open on both editors and just switch to compile. Most people use visual C++ to generate DLLs for the complex part of the EA code.

 
Ruptor:

Just a suggestion but you could have the file open on both editors and just switch to compile. Most people use visual C++ to generate DLLs for the complex part of the EA code.


as far as i know the MT4 editor doesnt automatically reload a changed file,

i have to close it and reopen.

i compile my sourcecodes even after small changes to detect errors very early, even if i havent finished the changes i want to do.

thanks for your suggestion, but i have already done it this way, and this is no comfortable solution.

for the complex parts of code i prefer perl or php, really powerful languages.

C is only useful if you need speed. i use it for coding modules for www.synthedit.com

C is a boring language ;-)

 
I looked into it in the past and gave up. But it might be possible... See: https://www.mql5.com/en/forum/112268
 
meikel:

my suggestion is, to provide the compiler as standalone exe file, this should be easy to establish, or, call the editor with switches like /compile /file=test.mq4

I may be missing the point but, as gordon is saying... the compiler is a standalone file: metalang.exe. For example, I routinely compile MQ4 code using a batch file which calls metalang.exe and then copies the ex4 into multiple installations of MT4. (I also compile using build 220 of metalang.exe: https://www.mql5.com/en/forum/117233.)

 
jjc wrote >>

I may be missing the point but, as gordon is saying... the compiler is a standalone file: metalang.exe. For example, I routinely compile MQ4 code using a batch file which calls metalang.exe and then copies the ex4 into multiple installations of MT4. (I also compile using build 220 of metalang.exe: https://www.mql5.com/en/forum/117233.)

Yes, me to. Call metalang.exe from batch or some function in your editor (dll for example). Need only two parameters to pass ... source file and destination file :-)

 

oops.

i havent noticed that there is metalang.exe

non existing problem solved. ;-)

thanks!


for all others like me who also missed the metalang.exe file (the standalone compiler) here the summary:

copy metalang.exe from the installation directory into your experts folder (because of this you dont need to add a path to your filenames )

open a dosbox in the experts folder and type for example

metalang test.mq4 test.ex4 > test.log

this compiles test.mq4 to test.ex4 and writes errors in test.log

 
Yeah, but the tricky part is to understand the log... It's undocumented. At the time when I was trying to do that I just didnt have the time to figure out all the error codes. Anyway, if u do that, then please share. Thanks!
 

as far as i know the MT4 editor doesnt automatically reload a changed file,

Yes it does, I save, switch and press F5. no problem. I do edit in the mt4/experts folder if that makes a difference.

 
gordon:
Yeah, but the tricky part is to understand the log... It's undocumented. At the time when I was trying to do that I just didnt have the time to figure out all the error codes. Anyway, if u do that, then please share. Thanks!

It may depend on what you want to use the log/error codes for. If you just want to check for success/failure of the compilation, then %ERRORLEVEL% (i.e. the exit code from metalang.exe) will give you that. Zero for success; non-zero for failure. Non-critical warnings (e.g. redundant functions) leave the exit code set to zero.

 


i just made a language file for Geany Editor, its not perfect.

i havent figured out how to do a special MQ4 file, so i modified the C definition file, it will override the default C file. simply copy it in the "geany installation/data" folder (filetypes.c)

thanks Cloudbreaker i havent had much work to get the keywords list for highlighting (Alphabetic Index of MQL4 Functions https://www.mql5.com/en/forum/122679)

additional the modified filetype_extensions.conf in the same folder mentioned above.

change the last line of filetypes.c to the path where your metalang.exe is, then relaunch geany and pressing F5 compiles as usual

here the last line, change the path to your metalang.exe

run_cmd="E:\Programme\MBT MetaTrader 4\metalang.exe" "%f"

Files:
geanyomq4.zip  4 kb
Reason: