Search code examples
omnet++veins

OMNeT++/Veins problem using cSimpleModule


I'm implementing vanet with OMNeT++ 5.3 and Veins 4.7.1 but I'm experiencing errors that I can't solve.

The code:

public:
    SienaStatisticsAccess() { }
    SienaStatistics* getIfExists() {
        //Finds a module by its path.
        return dynamic_cast<SienaStatistics*>(simulation.getModuleByPath("stats"));
    }

The error:

'simulation’ was not declared in this scope

Solution

  • The code should look like:

    return dynamic_cast<SienaStatistics*>(getSimulation()->getModuleByPath("stats"));
    

    Using this at least the 'simulation’ was not declared in this scope will be gone.