Skip to content

Linker error undefined reference to .. if I use the MQTT_CLIENT_STD_FUNCTION_CALLBACK #98

Closed as not planned
@ma-bg

Description

@ma-bg

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.

Metadata

Metadata

Assignees

Labels

topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions