Closed Turbox35 closed 7 months ago
Well, the error message is clear: You are calling a function that expects other parameters than you are sending. If you look at PubSubClient.h, you'll see that there are four different ways to call "publish":
boolean publish(const char* topic, const char* payload);
boolean publish(const char* topic, const char* payload, boolean retained);
boolean publish(const char* topic, const uint8_t * payload, unsigned int plength);
boolean publish(const char* topic, const uint8_t * payload, unsigned int plength, boolean retained);
Yours is of the structure const char*, String&, size_t&, bool
. So it doesn't expect your string but rather a char pointer.
Hello,
This is not a bug or request, the problem is on my side. I would like to publish MQTT message at the end of the setup (run one time at the end of the boot) and I use the command:
MQTTPubSubClient->publish(Topic.c_str(), output, n, true);
But it fails.BSB-LAN-master\BSB_LAN\BSB_LAN_custom_setup.h:50:66: error: no matching function for call to 'PubSubClient::publish(const char*, String&, size_t&, bool)'
Is it due to the MQTT client which is not already declared? Or I miss something?Many thanks.