ESP8266WebServer inside custom class

I need to call ESP8266WebServer::on from inside my custom class, unfortunately i get an error.

error: no matching function for call to 'ESP8266WebServer::on(const char [6], HTTPMethod, FFWebServer::init()::__lambda1, <unresolved overloaded function type>)'

I have done some searching but could not understand anything I found. No simple explanation.

This works:

void handleRoot(){}
server.on("/", handleRoot);

This doesn’t:

void myClass::handleRoot(){}
void myClass::setup(){
    server.on("/", handleRoot);
}

The second argument to server.on is

typedef std::function<void(void)> THandlerFunction;

Hi @Thiago_Wenzel
It’s definately not a PlatformIO issue and we can’t help you here, but have you tried server.on("/", std::bind(&myClass::handleRoot, this)); as suggested here?

@valeros Thank you for your reply, the sugested solution worked. I`m sorry to have gone out of topic here.