ERR_NO_ERROR doesn't work

 

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 ));
}
}

 
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>

Reason: