Hi, grateful if anyone can point me in the right direction with this issue. I've been working on a ESP8266 project for a few days and everything has been going fine. I noticed a message advising I had two copies of a library so thought I would tidy things up and moved all my libraries to C:\Users\Peter\Documents\Arduino\libraries where most of them were already located.
Suddenly I get this error message on my Esp8266 Sketch:
'class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>' has no member named 'setHostname'
Other sketches compile OK.
I can still compile the same sketch on my laptop with IDE 1.8.13 ArduinoOTA Library 1.0.5 - no problems
But using my PC with the same IDE and Library I get the error message - SO - the sketch is fine, the IDE is fine, the Library is fine - but in moving the libraries I have created a problem.
I've tried these steps:
- Restored the deleted libraries to their original locations
- Uninstalled and re-installed the latest version of IDE
- Searched the net and read the post: ESP8266 OTA Example Won't Compile - #9 by CaptClaude - PlatformIO Community - but dont think it's relevant to this problem
- Compared the Library files on my laptop with those on my PC
Short of rebuilding the PC I'm out of ideas - any suggestions? Thanks in advance.
Full error message below:
Arduino: 1.8.13 (Windows 7), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Flash, Legacy (new can return nullptr), All SSL ciphers (most compatible), 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled, None, Only Sketch, 115200"
\\NAS_DUO\backup\Documents\Ardiuno\Sketches\Kegerator_Testing\Kegerator_Testing.ino: In function 'void setup_OTA()':
Kegerator_Testing:279:14: error: 'class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>' has no member named 'setHostname'
ArduinoOTA.setHostname("test_keg"); //was ESP8266
^
Kegerator_Testing:280:14: error: 'class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>' has no member named 'setPassword'
ArduinoOTA.setPassword("test8266");
^
Kegerator_Testing:281:14: error: 'class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>' has no member named 'onStart'
ArduinoOTA.onStart([]() {
^
Kegerator_Testing:284:14: error: 'class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>' has no member named 'onEnd'
ArduinoOTA.onEnd([]() {
^
Kegerator_Testing:287:14: error: 'class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>' has no member named 'onProgress'
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
^
Kegerator_Testing:290:25: error: 'ota_error_t' has not been declared
ArduinoOTA.onError([](ota_error_t error) {
^
\\NAS_DUO\backup\Documents\Ardiuno\Sketches\Kegerator_Testing\Kegerator_Testing.ino: In lambda function:
Kegerator_Testing:292:18: error: 'OTA_AUTH_ERROR' was not declared in this scope
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
^
Kegerator_Testing:293:23: error: 'OTA_BEGIN_ERROR' was not declared in this scope
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
^
Kegerator_Testing:294:23: error: 'OTA_CONNECT_ERROR' was not declared in this scope
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
^
Kegerator_Testing:295:23: error: 'OTA_RECEIVE_ERROR' was not declared in this scope
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
^
Kegerator_Testing:296:23: error: 'OTA_END_ERROR' was not declared in this scope
else if (error == OTA_END_ERROR) Serial.println("End Failed");
^
\\NAS_DUO\backup\Documents\Ardiuno\Sketches\Kegerator_Testing\Kegerator_Testing.ino: In function 'void setup_OTA()':
Kegerator_Testing:297:4: error: invalid user-defined conversion from 'setup_OTA()::__lambda8' to 'void (*)(int, const char*)' [-fpermissive]
});
^
\\NAS_DUO\backup\Documents\Ardiuno\Sketches\Kegerator_Testing\Kegerator_Testing.ino:290:42: note: candidate is: setup_OTA()::__lambda8::operator void (*)(int)() const <near match>
ArduinoOTA.onError([](ota_error_t error) {
^
\\NAS_DUO\backup\Documents\Ardiuno\Sketches\Kegerator_Testing\Kegerator_Testing.ino:290:42: note: no known conversion for implicit 'this' parameter from 'void (*)(int)' to 'void (*)(int, const char*)'
Kegerator_Testing:298:20: error: no matching function for call to 'ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>::begin()'
ArduinoOTA.begin();
^
\\NAS_DUO\backup\Documents\Ardiuno\Sketches\Kegerator_Testing\Kegerator_Testing.ino:298:20: note: candidate is:
In file included from \\NAS_DUO\backup\Documents\Ardiuno\Sketches\Kegerator_Testing\Kegerator_Testing.ino:14:0:
C:\Users\Peter\Documents\Arduino\libraries\ArduinoOTA\src/ArduinoOTA.h:87:8: note: void ArduinoOTAMdnsClass<NetServer, NetClient, NetUDP>::begin(IPAddress, const char*, const char*, OTAStorage&) [with NetServer = WiFiServer; NetClient = WiFiClient; NetUDP = WiFiUDP]
void begin(IPAddress localIP, const char* name, const char* password, OTAStorage& storage) {
^
C:\Users\Peter\Documents\Arduino\libraries\ArduinoOTA\src/ArduinoOTA.h:87:8: note: candidate expects 4 arguments, 0 provided
exit status 1
'class ArduinoOTAMdnsClass<WiFiServer, WiFiClient, WiFiUDP>' has no member named 'setHostname'
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Relevant Parts of Sketch:
#include <ESP8266WiFi.h>
#include <ArduinoOTA.h>
#include <PubSubClient.h>
#include <ESP8266WebServer.h>
#include <OneWire.h>
#include <DallasTemperature.h>
void setup() {
Serial.begin(115200); // Start the Serial communication to send messages to the computer
Serial.println('\n');
sensors.begin();
setup_wifi();
setup_OTA();
setup_MQTT();
setup_web_server();
pinMode(compPin, OUTPUT);
digitalWrite(compPin, 0); // compressor Relay off to start (Low State) // fan Relay off to start (High State)
compressorOff = millis(); //initial delay starting compressor
readTemp();
}
void setup_OTA(){
ArduinoOTA.setHostname("test_keg"); //was ESP8266
ArduinoOTA.setPassword("test8266");
ArduinoOTA.onStart([]() {
Serial.println("Start");
});
ArduinoOTA.onEnd([]() {
Serial.println("\nEnd");
});
ArduinoOTA.onProgress([](unsigned int progress, unsigned int total) {
Serial.printf("Progress: %u%%\r", (progress / (total / 100)));
});
ArduinoOTA.onError([](ota_error_t error) {
Serial.printf("Error[%u]: ", error);
if (error == OTA_AUTH_ERROR) Serial.println("Auth Failed");
else if (error == OTA_BEGIN_ERROR) Serial.println("Begin Failed");
else if (error == OTA_CONNECT_ERROR) Serial.println("Connect Failed");
else if (error == OTA_RECEIVE_ERROR) Serial.println("Receive Failed");
else if (error == OTA_END_ERROR) Serial.println("End Failed");
});
ArduinoOTA.begin();
Serial.println("OTA ready");
}
void loop() {
ArduinoOTA.handle();
if (!client.connected()) {
reconnect();
}
client.loop();
server.handleClient();
checkTheTime();
}