#include

 

Hey all. This is from a newby to mt4 programming. I have an EA I had programmed (I have the source code). That EA uses the #include command to include both variable and function files which are stored in the same directory that the EA is installed in (terminal/experts). The format for that command is: #include "filename.mqh" and not the <filename.mqh>

In that directory, I have no problem compiling it when I make modifications to it.

However, I copied the EA and the various var and func files to another drive for archiving and working purposes and will then only have the *.ex4 file and the *.mqh files in the terminal/experts directory .

The problem for me is that the copies of the EA and the various var and func files are located on another drive (drive e:). When I open the editor, load up the EA and then compile it, the first var file and the first func file compile okay, but all the other var and func files are errors. The error on each of them gives me the filename of the var of runc file with the error "cannot open the program file".

I have verified the files to be in the same directory and loaded the *.mq4 into the editor from the e: drive. I cannot compile the *.mq4 (the EA, not the *.mqh var and func files) without the errors.

Any help or suggestions are appreciated. Thanks in advance.

 
Are the source files in the experts folder or not?
 
gordon:
Are the source files in the experts folder or not?

gordon, the original EA and all the *.mqh var and func files are still in the terminal/experts directory. I made copies of all of them and placed them in a subdirectory on my e: drive for working and tweaking purposes.

When I load the EA from the e: drive, it will not compile. The errors occur on all of the var and func files except the first var and the first fun file. Clues?

 
wtbstv:

gordon, the original EA and all the *.mqh var and func files are still in the terminal/experts directory. I made copies of all of them and placed them in a subdirectory on my e: drive for working and tweaking purposes.

When I load the EA from the e: drive, it will not compile. The errors occur on all of the var and func files except the first var and the first fun file. Clues?

What do u mean "When I load the EA from the e: drive"...? What errors do u get?
 
gordon:
What do u mean "When I load the EA from the e: drive"...? What errors do u get?

when I load the EA (the *.mq4) into the editor I select the EA file on the e: drive. I do not get any errors then. The errors come when I then hit the compile option in the editor. Then the errors post during the compiling process
 
I see. Well, officially "If the file name is enclosed in quotation marks, the search will be performed in the current directory (where the main file of the source code is located). The standard directory is not searched in." (from: https://docs.mql4.com/basis/preprosessor/include). Are the included files in the same directory as the file you are trying to compile?
 
gordon:
I see. Well, officially "If the file name is enclosed in quotation marks, the search will be performed in the current directory (where the main file of the source code is located). The standard directory is not searched in." (from: https://docs.mql4.com/basis/preprosessor/include). Are the included files in the same directory as the file you are trying to compile?

yes. I have triple checked. I would think that I might have made some sort of mistake except that the first var file and the first func file are included just fine and have no errors associated with them when I try to compile. But each and every other var or fun file have the error when I compile.
 
Can you post the errors u get?
 

'FRI05_MAVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (159, 1)
'FRI05_EntryVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (160, 1)
'FRI05_NTRVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (161, 1)
'FRI05_FilterVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (162, 1)
'FRI05_VStopVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (163, 1)
'FRI05_SDCVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (164, 1)
'FRI05_FibVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (165, 1)
'FRI05_LCVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (166, 1)
'FRI05_MAFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (185, 1)
'FRI05_EntryFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (186, 1)
'FRI05_MOFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (187, 1)
'FRI05_NTRFun002.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (188, 1)
'FRI05_MgmtFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (189, 1)
'FRI05_ExitFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (190, 1)
'FRI05_AcctFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (191, 1)
'FRI05_FilterFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (192, 1)
'FRI05_VStopFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (193, 1)
'FRI05_SDCFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (194, 1)
'FRI05_FibFun002.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (195, 1)
'FRI05_LCFun002.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (196, 1)
20 error(s), 0 warning(s)

Below are the two code snippets with the include commands

//*******************************************

//Variable includes
#include "FRI05-FracVar001.mqh"
#include "FRI05_MAVar001.mqh"
#include "FRI05_EntryVar001.mqh"
#include "FRI05_NTRVar001.mqh"
#include "FRI05_FilterVar001.mqh"
#include "FRI05_VStopVar001.mqh"
#include "FRI05_SDCVar001.mqh"
#include "FRI05_FibVar001.mqh"
#include "FRI05_LCVar001.mqh"

//Function includes
#include "FRI05-FracFun001.mqh"
#include "FRI05_MAFun001.mqh"
#include "FRI05_EntryFun001.mqh"
#include "FRI05_MOFun001.mqh"
#include "FRI05_NTRFun002.mqh"
#include "FRI05_MgmtFun001.mqh"
#include "FRI05_ExitFun001.mqh"
#include "FRI05_AcctFun001.mqh"
#include "FRI05_FilterFun001.mqh"
#include "FRI05_VStopFun001.mqh"
#include "FRI05_SDCFun001.mqh"
#include "FRI05_FibFun002.mqh"
#include "FRI05_LCFun002.mqh"

//**********************************************

Each of the above include files are in the same directory as the EA with the correct name exactly. Notice that there was not an error for either of the FRAC var or func files. They are also in the same directory.

This is the entire error message that I get. I also have two files, an FRI05_

 
wtbstv:

'FRI05_MAVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (159, 1)
'FRI05_EntryVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (160, 1)
'FRI05_NTRVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (161, 1)
'FRI05_FilterVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (162, 1)
'FRI05_VStopVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (163, 1)
'FRI05_SDCVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (164, 1)
'FRI05_FibVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (165, 1)
'FRI05_LCVar001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (166, 1)
'FRI05_MAFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (185, 1)
'FRI05_EntryFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (186, 1)
'FRI05_MOFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (187, 1)
'FRI05_NTRFun002.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (188, 1)
'FRI05_MgmtFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (189, 1)
'FRI05_ExitFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (190, 1)
'FRI05_AcctFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (191, 1)
'FRI05_FilterFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (192, 1)
'FRI05_VStopFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (193, 1)
'FRI05_SDCFun001.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (194, 1)
'FRI05_FibFun002.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (195, 1)
'FRI05_LCFun002.mqh' - cannot open the program file E:\7Step\FOREX Robotics\EA\FRI05\FRI05-001.mq4 (196, 1)
20 error(s), 0 warning(s)

Below are the two code snippets with the include commands

//*******************************************

//Variable includes
#include "FRI05-FracVar001.mqh"
#include "FRI05_MAVar001.mqh"
#include "FRI05_EntryVar001.mqh"
#include "FRI05_NTRVar001.mqh"
#include "FRI05_FilterVar001.mqh"
#include "FRI05_VStopVar001.mqh"
#include "FRI05_SDCVar001.mqh"
#include "FRI05_FibVar001.mqh"
#include "FRI05_LCVar001.mqh"

//Function includes
#include "FRI05-FracFun001.mqh"
#include "FRI05_MAFun001.mqh"
#include "FRI05_EntryFun001.mqh"
#include "FRI05_MOFun001.mqh"
#include "FRI05_NTRFun002.mqh"
#include "FRI05_MgmtFun001.mqh"
#include "FRI05_ExitFun001.mqh"
#include "FRI05_AcctFun001.mqh"
#include "FRI05_FilterFun001.mqh"
#include "FRI05_VStopFun001.mqh"
#include "FRI05_SDCFun001.mqh"
#include "FRI05_FibFun002.mqh"
#include "FRI05_LCFun002.mqh"

//**********************************************

Each of the above include files are in the same directory as the EA with the correct name exactly. Notice that there was not an error for either of the FRAC var or func files. They are also in the same directory.

This is the entire error message that I get. I also have two files, an FRI05_


gordon, these include commands appear directly before (that is just prior to) the

int init()

 
I'm not sure. I did some experimentation with a similar setup (I mean trying to compile a file and a bunch of includes that do not reside in the experts folder) and it seems to work fine here... So I have no suggestion except the obvious - why are u using an 'external' folder in the first place? And whats the point of breaking up an expert into so many include files?
Reason: