Skip to content

Callback was not decleared #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jonasnic opened this issue May 15, 2016 · 6 comments
Closed

Callback was not decleared #1

jonasnic opened this issue May 15, 2016 · 6 comments

Comments

@jonasnic
Copy link

jonasnic commented May 15, 2016

I downloaded it
i have installed the esp board lib.
but when i try to compile i say that call back is not decleared at this line.
PubSubClient client(MQTT_SERVER, 1883, callback(), wifiClient);
arduino ide 1.6.9

@ItKindaWorks
Copy link
Owner

This is a known issue with the ESP core for Arduino (Even though it seems like its the PubSubClient, I'm pretty sure its an issue related to the core files). It's not yet compatible with 1.6.9 - I use 1.6.5 for everything ESP related. Try using that and let me know if it compiles then.

@jonasnic
Copy link
Author

I still use 1.6.9 but used the example that came withe the pubsubclient,
and it works as a charm.

This is a known issue with the ESP core for Arduino (Even though it seems
like its the PubSubClient, I'm pretty sure its an issue related to the core
files). It's not yet compatible with 1.6.9 - I use 1.6.5 for everything ESP
related. Try using that and let me know if it compiles then.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#1 (comment)

@ItKindaWorks
Copy link
Owner

That is why it's an issue with the ESP core files. None of the examples in my pubsubclient folder are for the ESP and dont include the "ESP8266WIFI.h" library. The examples compile on my version of 1.6.9 as well but with the ESP library included it fails.

@jonasnic
Copy link
Author

In the pubsubclient there is an example called mqtt_esp8266. And that is
working for me. I'm using it now.
17. mai 2016 03:28 skrev "ItKindaWorks" [email protected]:

That is why it's an issue with the ESP core files. None of the examples in
my pubsubclient folder are for the ESP and dont include the "ESP8266WIFI.h"
library. The examples compile on my version of 1.6.9 as well but with the
ESP library included it fails.


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub
#1 (comment)

@digitalkarl
Copy link

Doesn't it fail because the compiler needs to know about the functions ahead of time?? So using function prototypes solved this for me:
void callback(char* topic, byte* payload, unsigned int length);
String macToStr(const uint8_t* mac);
void reconnect();
Compiles normally under 1.6.9 and 1.6.7

@ItKindaWorks
Copy link
Owner

Yes that is the problem and under a normal compiler you would have to declare the prototype at the top of the code but the ESP-Arduino compiler is supposed to handle this for users. It has been acknowledged by their community as well over here. They compile just fine for me on 1.6.5 but fail once I try it on anything above. The solution of placing the prototype at the top of the file works so far as this issue is concerned but doesn't actually solve the systemic issue which is caused by the ESP compiler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants