Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • it is a know bug in Arduino toolchain. copy the callback function before the first use. before client declaration. Commented Mar 22, 2018 at 6:34
  • @Juraj I've changed it, but I found the same error Commented Mar 23, 2018 at 12:23
  • update the code in the question Commented Mar 23, 2018 at 12:35
  • have you tried adding void callback(char* topic, byte* payload, unsigned int length); (exactly that one line with ; at the end) before PubSubClient client(MQTT_SERVER, 1883, callback, wifiClient); Commented Mar 23, 2018 at 23:02
  • @Juraj - that's not a bug, that's how C++ rolls - you can't "reference" a function in code before you "declare" it - also, moving callback will mean the callback function will try to "reference" client before it is declared, so, similar (but not exactly the same) error will occur - declaring the function callback before client will fix the issue Commented Mar 23, 2018 at 23:06