compile error 'MY_ESP8266_SSID' was not declared in this scope
willemx last edited by
A few months ago I built a MQTT gateway using the MQTTgatewayESP8266 sketch and it has been running succesfully ever since. I now need to make a small modification, but I am unable to compile the sketch anymore. I have not changed anything to the code yet, but only updated Arduino to V1.8.7 (from 1.8.5) and updated to the latest board definitions.
I am getting this error when compiling the MQTTgatewayESP8266 sketch (for NodeMCU V1 board):
In file included from /Users/willem/Documents/Arduino/libraries/MySensors/MySensors.h:194:0, from /Users/willem/Documents/Arduino/MQTTgatewayESP8266/MQTTgatewayESP8266.ino:124: /Users/willem/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportMQTTClient.cpp: In function 'bool gatewayTransportInit()': /Users/willem/Documents/Arduino/libraries/MySensors/core/MyGatewayTransportMQTTClient.cpp:28:22: error: 'MY_ESP8266_SSID' was not declared in this scope #define MY_WIFI_SSID MY_ESP8266_SSID ^
Of course MY_ESP8266_SSID is still defined just like it was months ago:
// Set WIFI SSID and password #define MY_ESP8266_SSID "FRITZREP"
I tried to rebuild everything, uninstalled and re-installed Arduino, libs and boards, but I can't get it running anymore.
Does anyone have a suggestion on how to tackle this?
@willemx which version of MySensors are you using? The latest esp board definitions only work with MySensors development version, so that might be the cause of the problem.
willemx last edited by willemx
@mfalkvidd I'm using MySensors lib Version 2.3.0 (the same version I used when everything worked) and esp8266 boards package version 2.4.2
Edit: I switched back to boards package version 2.4.0 (and also tried 2.4.1) but the error remains the same.
I am not surprised by this, because I think the error is somewhere else: the error message is simply stating that the preprocessor cannot find the definition of MY_ESP8266_SSID. Very strange, because it clearly is defined.
I noticed one peculiar thing: in my source code all defined symbols are color coded, for example in the line :
#define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
'#define' is green, 'MY_MQTT_PUBLISH_TOPIC_PREFIX' is light-blue and "mygateway1-out" is darker-blue, however, in the line:
#define MY_ESP8266_SSID "FRITZREP",
'#define' is green, "FRITZREP" is darker-blue, but 'MY_ESP8266_SSID' is black.
Not sure if this has any significance...
@willemx strange. It is not possible to compile MySensors 2.3.0 with the 2.4.2 board definitions on my computer, and several other people have reported the same problem. You should get the error mentioned in https://forum.mysensors.org/topic/9558/error-compiling-gateway-for-esp8266-node-mcu-1-0-e12
I am not sure if the lack of that error affects your setup, but could you check if using MY_WIFI_BSSID instead of MY_ESP8266_SSID works better?
This code removes the SSID define, my guess is that this code is involved somehow
#ifdef MY_ESP8266_SSID #warning MY_ESP8266_SSID is deprecated, use MY_WIFI_SSID instead! #define MY_WIFI_SSID MY_ESP8266_SSID #undef MY_ESP8266_SSID // cleanup #endif
But the code and the error doesn't make sense, since line 26 checks if the define exists. Maybe there is an issue with caching?
willemx last edited by
@mfalkvidd : thank you for your help. I think you are right about the #undef.
However, using MY_WIFI_BSSID instead of MY_ESP8266_SSID got rid of the original error, but produced lots of other errors in return. So I tried again removing Arduino, libs and board packages and reinstalling everything from scratch using older versions.
I have it working again now, using MySensors version 2.2.0, esp8266 version 2.4.1 and Arduino version 1.8.7.
So I won't be updating libs and board packages any time soon again. This appears to be very risky, or is there a way I could have known this? I could not find any release notes that warned about these breaking changes.
I think for someone who is coming new to all this and just installs the current libs/packages it must be very hard to get things working...
@willemx I don't understand all the details, but here is how I have understood the situation:
MySensors needed to override some internal esp8266 functions to seamlessly (for the sketch developer) provide the same features that MySensors offers for other microcontrollers.
The esp team changed those functions in the 2.4.2 release, which caused compile errors for sketch developers if they upgraded the board definitions.
MySensors development version was modified to handle the new functions. By doing this, it was no longer possible to compile MySensors with the old (and still widely used, most people don't upgrade their board definitions) esp8266board definitions.
So when a new release of MySensors is done, everyone who hasn't upgraded their board definition but have upgraded the MySensors library will be unable to compile their code. On the upside, everyone who has upgraded their board definitions will be able to compile without trouble.
The only "safe" way (for future upgrades) is to remove important functionality, eliminating the need to override internal esp functions. But that will also get a lot of people into trouble.
So what we've got is that whatever we do, people will get into trouble.
There are no warnings in the esp8266 release notes because the esp team is not responsible for keeping compatibility with internal functions.
There are no warnings in the MySensors release notes because the latest MySensors release was made before the esp8266 changes were present.
There will be a note in the release notes for the next MySensors release.