Singleton class leads to "unexpected token. probably type is missing"

 

Hi, when I call a member method of my singleton class, I receive the error message "unexpected token, probably type is missing" during compilation.

This is the code

Config * cfg  = getEURUSD_m15_R3();
ConfigManager* cm = ConfigManager::getInstance();
cm.addConfig(cfg); // <-------------------------- RAISES ERROR

Error:

'cm' - unexpected token, probably type is missing? MyEa.mq5 125 1


When I delete that line

cm.addConfig(cfg);

the EA can be compiled without errors.



And this would be the singleton class:

#include "ConfigTypes.mqh"
#include "Config.mqh"

class ConfigManager 
{
    protected:
    ConfigManager(){
        ArrayResize(configs,0);
        //fillconfigs manually
        current_idx=-1;
        };
    static ConfigManager* _instance; //Singleton instance
    ulong current_idx;

    
    public:
    static ConfigManager* getInstance(){
        if (!_instance) //if not valid yet
        {
            _instance = new ConfigManager();
            if( _instance == NULL )     // this would be a catasrophic failure
            { 
                int err_code=GetLastError();
                string comment_string=__FUNCTION__+": ConfigManager Constructor failed, error: "+IntegerToString(err_code);
                //Comment(comment_string); 
                Print(comment_string);
            }
            
        }
        return _instance;
    }

    static Config* get(){
        Config * cfg=ConfigManager::getInstance().getConfig();
        return cfg;
    }
    Config* selectConfig(string symbol, ENUM_TIMEFRAMES tf, RiskLevel risklevel);
    Config* configs[];
    Config* getConfig();
    void addConfig(Config * cfg);

    ConfigManager(ConfigManager const&){};          // Private Copy Constructor prevents copy of the object as part of Singleton pattern
    ConfigManager operator=(ConfigManager const&);  // Private Assignment Operator, prevents assignment as part of Singleton pattern

};

ConfigManager *ConfigManager::_instance=NULL;  // Initialize Global Pointer;


Config* ConfigManager::getConfig()
{
    return configs[current_idx];
}

void ConfigManager::addConfig(Config* cfg)
{   
    arrayPush(configs, cfg);
    current_idx=ArraySize(configs)-1;
}


Config* ConfigManager::selectConfig(string symbol, ENUM_TIMEFRAMES tf, RiskLevel risklevel)
{
    Config * invalid_res=NULL;
    for (int i=0; i<ArraySize(configs); i++)
    {
        Config * cfg = configs[i];
        if (StringFind(symbol, cfg.symbol)>=0 && cfg.time_frame == tf && cfg.risk==risklevel)
        {
            current_idx=i;
            return cfg;
        }
    }
    return invalid_res; //check it via if(CheckPointer(pointer)==POINTER_INVALID)
}



I really dont get any ideas what the problem could be. Maybe some double includes of the Config classe, or wrong method declaration??

Thanks everyone for every hint!

Reason: