Open WombatHollow opened 5 years ago
You'll have to define MQTT_MAX_PACKET_SIZE in the makefile or on the commandline. Maybe Arduino IDE has some means to make defines, I don't know. I personally don't use the IDE.
What's happening now is that while compiling your main.cpp (wrapping your Arduino sketch .uno) MQTT_MAX_PACKET_SIZE gets defined as 256 which propagates to the interpretation of PubSubClient.h. Before that the compile process has compiled PubSubClient.cpp (which is also including PubSubClient.h) with the MQTT_MAX_PACKET_SIZE = default. This means the the PubSubClient.o contains a buffer['default'] while your main.o refers to a buffer[256]. And that is what the (I guess) linker is complaining about.
Commented out the #define and warnings went away. Found I could
#define MQTT_MAX_PACKET_SIZE 128
but set it to any value smaller or larger and you get the warnings?
Maybe an issue to fix next time as the .h file has a #ifndef MQTT_MAX_PACKET_SIZE
switch on it which I thought would stop it overwriting the buffer size set in the sketch.
Thanks for your help
Just returned to my project after 6 months, and updated PubSubClient to 2.7.0 and now get 5 warnings in PubSubClient package at compile time. Went back to 2.4.0 and these warnings disappear.
In regard to MQTT_MAX_PACKET_SIZE, I do define that as 256 (this produces a warning in 2.4.0 (fixed in 2..7.0) but that I can fix) otherwise it is all a standard code as below (just a snippet)
Target Environment is Leonardo with W5500 Ethernet.
I haven't got to loading and running again to see if this runs OK, I have a few things to build and more Code to write.
Any idea why I get these warnings?