Undeclared identifier error when changing a function to a template

 

Hi,

I want to change code below to a template so that I can used it on enum data type,

bool GetIniKey(string fileName,string section,string key,int &ReturnedValue)
  {
   string result=GetRawIniString(fileName,section,key);

   if(StringLen(result)>0)
     {
      ReturnedValue=(int) StringToInteger(result);
      return (true);
     }
   else
     {
      ReturnedValue=NULL;
      return (false);
     }
  }

I change it to be like this,

template<typename T>
bool GetIniKey(string filename, string section, string key, T &ReturnedValue)
   {
   string result=GetRawIniString(fileName,section,key);

   if(StringLen(result)>0)
     {
      ReturnedValue=(T) StringToInteger(result);
      return (true);
     }
   else
     {
      ReturnedValue=NULL;
      return (false);
     }
   }

I call the function using this code

if(GetIniKey(FileName, CurrentSymbol, "TradingMethod", tradingMethod)) {
        TradingMethod[SymbolLoop] = tradingMethod;
        Print("TradingMethod: ", TradingMethod[SymbolLoop]);
}

but it returns error with this message,

'fileName' - undeclared identifier      IniFile.mqh     86      34
   in template 'bool GetIniKey(string,string,string,T&)' specified with [T=TRADING_METHOD]      IniFile.mqh     84      6
   see template instantiation 'GetIniKey<TRADING_METHOD>'       Strategy1 Signal.mqh    614     13

Why this error occurred?