where are the include-ex4-files?

 

Hi,

I wrote my TimeShift-include-file. It is saved in ...\MQL4\Include\..

I compiled it with no errors and no warnings, an can use it by

#include <TimeShifts.mqh>

But if I want to use it in an imported way:

#import "TimeShifts.ex4"
void checkTime(datetime gmt);
datetime getBrokerTimeShift(); // return in sec the TimeShift to GMT of the Broker                              
#import

It cannot be used??

I can compile the indi. that 'imports' it without errors and only some warnings: 'i' is not used..

But starting this indicator I get this in the expert-tab:

2014.02.24 14:07:20.247 unresolved import function call
2014.02.24 14:07:20.247 Cannot call 'TimeShifts.ex4::checkTime', 'TimeShifts.ex4' is not loaded

Beside that I can't find the "TimeShifts.ex4" in \Include (nor in \Experts), neither in the /portable-Folder-structure nor in the default folder-structure?

What shall I do, what went wrong?

Gooly

PS: If I define in such an include-file global variables how can I use them directly in the loading indi. or EA and not by an extra defined function that just gives back this value?

 

When you need to create a library to be used with #import, it must be marked as library and have a defined interface. Did you specify that?

Anyway, the mqh is intended for source code inclusion, and it does not even need to compile alone. But you may include it into your library as well, even if the library contained only the library directive and the inclusion.

 
Ovo:

When you need to create a library to be used with #import, it must be marked as library and have a defined interface. Did you specify that?

Anyway, the mqh is intended for source code inclusion, and it does not even need to compile alone. But you may include it into your library as well, even if the library contained only the library directive and the inclusion.

Yes I defined:

#property library

and the mqh-file is saved in \Libraries but even there no ex4?

 
gooly:

Yes I defined:

and the mqh-file is saved in \Libraries but even there no ex4?




It has to be a mql4 source file not a mqh.
 

Yes that is the problem. When you create an include file, the file is saved uncompiled as .mqh in the MQL4\Include folder. When you create a library file it is a regular .mq4 file compiled to an .ex4. and saved in MQL4\Librarys. You could open a new library file in Metaeditor, copy paste the source code from your include file, compile the library file then try to import it to the main file.

 

ok, thanks, understood,

Gooly