Hi,
whilst I can recreate your error, my C++ knowledge is not good enough I know what the fix is.
The problem is this library expects the callback function signature to be:
void (*callback)(char*,uint8_t*,unsigned int)
but you are providing a callback that is a member of a class:
void EspMQTT::callback(char* topic, byte* payload, unsigned int length)
I don't know how to make those two match up in C++.
@vickeyhort - see the repository tomkcook/pubsubclient for a version that can handle this. You can set a callback from a class member function like this:
mqtt.set_callback([this] (char* topic, byte* payload, unsigned int length) { this->callback(topic, payload, length); }
@tomkcook the @knolleary "version" can also handle this with the ESP8266, as the OP requested:
mqtt.setCallback(std::bind(&YourClass:_yourCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
@vickeyhort, can you close this issue?
Here is the solution for the problem. Thank you so much @tomkcook for your help.
Most helpful comment
@tomkcook the @knolleary "version" can also handle this with the ESP8266, as the OP requested:
@vickeyhort, can you close this issue?