SanMiguel:
MQL4 gives an error with this code:
ERR_NO_ERROR variable not defined. This is the code I got from the MQL4 book.
void logError(string functionName, string msg, int errorCode = -1)
{
Print("ERROR: in " + functionName + "()");
Print("ERROR: " + msg );
int err = GetLastError();
if(errorCode != -1)
err = errorCode;
if(err != ERR_NO_ERROR)
{
Print("ERROR: code=" + err + " - " + ErrorDescription( err ));
}
}
I forgot to add the include files.
Corrected now.
#include <stderror.mqh>
#include <stdlib.mqh>
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
MQL4 gives an error with this code:
ERR_NO_ERROR variable not defined. This is the code I got from the MQL4 book.
void logError(string functionName, string msg, int errorCode = -1)
{
Print("ERROR: in " + functionName + "()");
Print("ERROR: " + msg );
int err = GetLastError();
if(errorCode != -1)
err = errorCode;
if(err != ERR_NO_ERROR)
{
Print("ERROR: code=" + err + " - " + ErrorDescription( err ));
}
}