I get this error, what’s the solution/work-around?
c:\Users\me\OneDrive\Documents\Arduino\libraries\AsyncMqttClient\src\AsyncMqttClient.cpp: In member function ‘AsyncMqttClient& AsyncMqttClient::setServer(const char*, const char*)’:
c:\Users\me\OneDrive\Documents\Arduino\libraries\AsyncMqttClient\src\AsyncMqttClient.cpp:142:28: error: ‘class MDNSResponder’ has no member named ‘IP’
142 | _ip = MDNS.IP(0);
| ^~
exit status 1
Compilation error: exit status 1
Hi.
How did you insert your MQTT ip address?
#define MQTT_HOST IPAddress(XXX, XXX, X, XX) // MQTT BROKER IP ADDRESS
Regards,
Sara
I edited that line in the INO file to indicate my IP (192.168.1.26) per “hostname -I” on my rPi 5 as indicated on page 296 of Learn_LVGL_Build_GUIs_for_ESP32_Projects_V1_1.pdf.
If I read the code correctly the AsyncMqttClient.cpp code has established a connection to the rPi before encountering the failure.
AsyncMqttClient& AsyncMqttClient::setServer(const char* serviceName, const char* protocol) {
_serviceName = serviceName;
_protocol = protocol;
// std::cout << “host name: ” << hostName << std::endl;
if (_hostName != “”) {
if (MDNS.begin(_hostName)) { // Nome do host do ESP32
int n = MDNS.queryService(_serviceName, _protocol);
if (n > 0) {
_ip = MDNS.IP(0);
_port = MDNS.port(0);
_useIp = true;
return *this;
}
}
}
}
Hi all, I have the exact same error message:
#define MQTT_HOST IPAddress(192, 168, 1, 109) //MQTT BROKER IP ADDRESS as shown with hostname -I on Raspberry
regards Juerg
Hi.
How did you install the recommended libraries? Did you install via .ZIP file as recommended in the eBook.
Please confirm which version of the MQTT libraries you have installed and the ESP32 boards version.
Regards,
Sara
Hi Sara,
First: it works now.
I installed the libraries from the ZIP files with the links provided in the Tutorial (I’m in the SMART HOME with Raspberry Pi, ESP32, and ESP8266) Chapter 5.1
The ESP32 core 3.0.4 provided the error
error: ‘class MDNSResponder’ has no member named ‘IP’
142 | _ip = MDNS.IP(0);
I then removed 3.0.4 and installed the last 2.x version 2.0.17 just to give it a try. Now it completes the compilation and linkag and uploads correctly to the ESP32.
regards Juerg
I also installed the libraries from the ZIP files by following the links in the book.
I’ll see if I have good luck following in Juerg’s foot steps.
I can’t find ESP core installed or otherwise.
Juerg, can you be more specific?
Thanks
Never mind. I was looking in libraries instead of boards. Things are working now.
Two errors with the .ino file for this unit:
In the file:
Learn_LVGL_Build_GUIs_for_ESP32_Projects/Code_Learn_LVGL_Build_GUIs_for_ESP32_Projects_V1/Module_5/5_6_1_MQTT_Publish_Button_Counter/5_6_1_MQTT_Publish_Button_Counter.ino
Are the lines:
const char* ssid = "REPLACE_WITH_YOUR_SSID";
const char* password = "REPLACE_WITH_YOUR_PASSWORD";
This is incorrect. Should read:
#define WIFI_SSID "REPLACE_WITH_YOUR_SSID"
#define WIFI_PASSWORD "REPLACE_WITH_YOUR_PASSWORD"
Also, the sketch will not compile after these changes due to the error reported above and repeated here with the versions of the libraries used.
~/Arduino/libraries/AsyncMqttClient/src/AsyncMqttClient.cpp: In member function 'AsyncMqttClient& AsyncMqttClient::setServer(const char*, const char*)':
~/Arduino/libraries/AsyncMqttClient/src/AsyncMqttClient.cpp:142:28: error: 'class MDNSResponder' has no member named 'IP'
142 | _ip = MDNS.IP(0);
| ^~
Using library lvgl at version 9.1.0 in folder: ~/Arduino/libraries/lvgl
Using library TFT_eSPI at version 2.5.43 in folder: ~/Arduino/libraries/TFT_eSPI
Using library SPI at version 3.0.4 in folder: ~/.arduino15/packages/esp32/hardware/esp32/3.0.4/libraries/SPI
Using library FS at version 3.0.4 in folder: ~/.arduino15/packages/esp32/hardware/esp32/3.0.4/libraries/FS
Using library SPIFFS at version 3.0.4 in folder: ~/.arduino15/packages/esp32/hardware/esp32/3.0.4/libraries/SPIFFS
Using library WiFi at version 3.0.4 in folder: ~/.arduino15/packages/esp32/hardware/esp32/3.0.4/libraries/WiFi
Using library Networking at version 3.0.4 in folder: ~/.arduino15/packages/esp32/hardware/esp32/3.0.4/libraries/Network
Using library AsyncMqttClient at version 0.9.0 in folder: ~/Arduino/libraries/AsyncMqttClient
Using library AsyncTCP at version 1.1.1 in folder: ~/Arduino/libraries/AsyncTCP
Using library ESPmDNS at version 3.0.4 in folder: ~/.arduino15/packages/esp32/hardware/esp32/3.0.4/libraries/ESPmDNS
Using library Preferences at version 3.0.4 in folder: ~/.arduino15/packages/esp32/hardware/esp32/3.0.4/libraries/Preferences
Using library XPT2046_Touchscreen at version 1.4 in folder: ~/Arduino/libraries/XPT2046_Touchscreen
exit status 1
Compilation error: exit status 1
The Arduino-esp32 core version used is 3.0.4
The book also says (pg 42):
“You should install version 3.0.3 (or higher). Some examples are not compatible with version 2.0.X”
Downgrading to arduino-esp32 core v2.0.17 is not an option as it will break other sketches written to use the new core v3.x.y.
Would you please correct the error in the .ino file and investigate and update the example so it runs with core v.3.x.y.
Thanks.
Hello Rob, Jürg and Dennis!
We’ve just released today the updated version of the LVGL eBook (version 1.2).
If you are logged in, you can download the latest version at: https://rntlab.com/module-1/esp32-lvgl-ebook/
This new version requires you to install the AsyncMQTTClient library through our forked repository (since the original owner hasn’t updated the library to make it compatible with Arduino ESP32 Core 3.X).
In our updated eBook version 1.2. Go to page 299, re-download and install the AsyncMQTT Client Library through our links.
- https://randomnerdtutorials.com/async-mqtt-client
- https://randomnerdtutorials.com/async-mqtt-client-docs
- https://randomnerdtutorials.com/async-mqtt-client-download
This library version is fully compatible with Arduino ESP32 Core 3.X.
The project example 5_6_1_MQTT_Publish_Button_Counter.ino has also been updated to use the correct ssid and password declarations.
Let me know if this updated version works for everyone!
Rui: Confirming all is working now with arduino-esp32 core v3.0.4 with Arduino IDE 2.3.2 (on Debian Linux 12 if that helps). Thanks.
Will you be updating the Code folder with the revised sketch for Module 5_6_1?
Also, in the sketch file there is:
extern “C” {
#include “freertos/FreeRTOS.h”
#include “freertos/timers.h”
}
Why encapsulate the #include’s here with extern “C” {}? Not necessary as both those files already do that? A holdover from using PlatformIO?
Hi all, same here. arduino-esp32 core v3.0.4 with Arduino IDE 2.3.2 on Windows 11. All works fine . I do get a warning though.
Compiling library “AsyncTCP”
c:\Users\Juerg\Documents\Arduino\libraries\AsyncMqttClient\src\AsyncMqttClient.cpp: In member function ‘AsyncMqttClient& AsyncMqttClient::setServer(const char*, const char*)’:
c:\Users\Juerg\Documents\Arduino\libraries\AsyncMqttClient\src\AsyncMqttClient.cpp:149:1: warning: control reaches end of non-void function [-Wreturn-type]
149 | }
| ^
But it completes and runs as it should. I will re-test the ESP-8266 MCU which had more problems but would open a separate topic on that.
Thank you for your help.
Jürg
Happy to hear that it worked! Yes, you can ignore those warnings Jürg.
We’ll be releasing a new version of the LVGL eBook in a few days. There was just an update of LVGL library that broke the projects.
The current eBook works under LVGL library version 9.1.
We’ll be updating the eBook to be fully compatible with version 9.2 probably on Monday.
Regards,
Rui
Hello again, Rob, Jürg and Dennis!
We’ve just released yesterday the updated version of the LVGL eBook (version 1.4).
If you are logged in, you can download the latest version at: https://rntlab.com/module-1/esp32-lvgl-ebook/
This new version works with LVGL library version 9.2 and with ESP32 Arduino Core 3.0.4.
Let me know if all the examples work!