[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 291

 
alsu >> :

You are confusing the notion of "library" (from which functions are extracted using #import) and "include header file" (#include).


Libraries lie in the libraries folder, their sources have the extension *.mq4, like indicators and Expert Advisors. They are compiled into the *.ex4 file (from which the ready functions are then imported into other programs, like this

In order to compile the library correctly, as a rule, you should first write the #property library directive.

Include header files are used to include ready-made pieces of code into various programs. They are stored in the includes folder, have the *.mqh extension and are included into the text (namely, into the text) of the program using the #include <...> directive; they do not have to be compiled separately, because they are compiled together with the main program.

By the way, earlier the library was generated by a template with #property library, and now it isn't. Does anyone know why they changed the template or just forgot to include?

PS if it wasn't for alsu I wouldn't have understood what the questioner wanted to know, I'm getting old.

 
Urain >> :

By the way, before the library was generated using a template with #property library, but now it is not, does anyone know why they changed the template or just forgot to include it?

PS if i had not alsu i would not understand what he wants to know.

you can manually tweak the template:)

 
alsu >> :

you can manually tweak the template:)

Yes yes I know, but in my time I killed 2 days to find the error, and it's a big deal in the new build a different template.

 
Urain >> :

>> ...if it wasn't for alsu, I wouldn't know what the questioner wanted to know, I'm getting old.

Experienced old timers, look at the code of the "asker's" library and explain me what the author meant when he wrote it?

 

Sorry.

A lot has been written, but I still don't understand the answer to my question. I will try once again to explain what I cannot do.

Suppose I have made an EA in which I have inserted the #include<...> directive and then made an include header file with a piece of code.

I have compiled the Expert Advisor and included it into a trade. Everything works. Based on Sergei Kovalev's quote:

"...Another thing you can add is that the ex4 file is self-sufficient - for it to work,
does not need to include the source codes of the user's functions.
You can copy the ex4 file, pass it to other traders and use it there.

"It is complete regardless of its technology.

I took my EA and copied it and transferred to another computer, to another trader. After that, the Expert Advisor does not want to work and writes that there is no function to which I am referring #include<...>, i.e., it does not see the include header file and cannot compile.

Here is an example of the Expert Advisor and include header file. See what the error is exactly on the question.

//+------------------------------------------------------------------+
//| Kibliot.mq4 |
//| Copyright © 2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"

#include <PointZigZag.mqh>

//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{PointZigZag();
Comment("Prod.-y21 = ",y21," ", "Pok.-x21 = ",x21);
return(0);
}

//+------------------------------------------------------------------+

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

//+------------------------------------------------------------------+
//| PointZigZag.mqh |
//| Copyright © 2009, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp.
#property link "http://www.metaquotes.net"

extern int intDepth = 12; //------- variables ZigZag
extern intNextDeviation = 5; //------- variables ZigZag.
extern intBackstep = 3; //------- variables ZigZag
extern inttern ShiftBars = 2; //------- variables ZigZag
//------- variables ZigZag ------------------------------------------
double y3, y2, y1, zz;//
int x3, x2, x1, sh;//
double x31, x21, x11; // ZigZag inflection point
double y31, y21, y11; // ZigZag inflection point
double TimeZZ, TimeOO;
//------------------------------------------------------------------------------

double PointZigZag()
{y3=0;y2=0;y1=0;
sh=ShiftBars;
while (y3==0)
{zz=iCustom(NULL, 0, "ZigZag", ExtDepth, ExtDeviation, ExtBackstep, 0, sh);
if (zz!=0 && zz!=EMPTY_VALUE)
{if (y1==0) { x1=sh; y1=zz; }
else if (y2==0) { x2=sh; y2=zz; }
else if (y3==0) { x3=sh; y3=zz; }}sh++;
}
if (High[x1]>High[x2])
{x11=High[x1]; x21=Low[x2]; x31=High[x3];
y11=0;y21=0;y31=0;TimeZZ=Time[x2];
}else
{y11=Low[x1]; y21=High[x2]; y31=Low[x3];
x11=0;x21=0;x31=0;TimeZZ=Time[x2];}

}

//+------------------------------------------------------------------+
 
please fix the error line that the compiler gives out in unchanged form
 
gvi2504 >> :

Sorry.

A lot has been written, but I still don't understand the answer to my question. I will try once again to explain what I cannot do.

Suppose I have made an EA in which I have inserted the #include<...> directive and then made an include header file with a piece of code.

I have compiled the Expert Advisor and included it into a trade. Everything works. Based on Sergei Kovalev's quote:

"...I can also add that ex4 file is self-sufficient - for it to work,
does not require include source codes of user functions.
The ex4 file can be copied, shared with other traders and used there.

"It is complete regardless of its technology.

I took my EA and copied it and transferred to another computer, to another trader. After that, the Expert Advisor does not want to work and writes that there is no function referred to by me #include<...>, i.e., it does not see the include header file and cannot compile.

Here is an example of the Expert Advisor and include header file. Look what exactly the error is in the question.


The file to be included must also be located on another computer in directory include, and in general, do not bother yourself, write everything on the same sheet, allocate a piece of code as a function, put it at the end of the sheet so it does not hang around and no turning on and off, why do you complicate your life. Directives #include and #import are needed (imho) to write a program complex with more than 1000 lines and consisting of several dozen separate programs, otherwise they are more confusing than helpful.

 
alsu >> :
Please fix the error line that the compiler generates

The compiler writes the following line

PointZigZag.mqh' - cannot open the program file D:\Program Files\MetaTrader2\experts\Kibliot.mq4 (10, 1)

 
gvi2504 >> :

The compiler writes the following line

PointZigZag.mqh' - cannot open the program file D:\Program Files\MetaTrader2\experts\Kibliot.mq4 (10, 1)

see answer above - put the include file PointZigZag.mqh in the include folder

 
alsu >> :

see answer above - put the include file PointZigZag.mqh in the include folder

On all computers where Kibliot.mq4 file is supposed to be compiled.

Reason: