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;