I've added the example from here #35 (comment) to my code.
MqttClient::MessageCallback callback = [this](MqttClient *client, int messageSize) {
Serial.print("Received message with topic: " + client->messageTopic());
};
mqttClient->onMessage(callback);
Then I got the following error:
undefined reference to MqttClient::onMessage(std::function<void (MqttClient*, int)>)
If I use the plain C function pointer things work fine. Any idea what might trigger my problem?
I'm using Arduino IDE 2.2.1 with an Arduino Nano ESP32.