You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Arduino IDE version (found in Arduino -> About Arduino menu): Platform IO
Trying to run the code from the ESP 32 secure example. Compile fails:
In file included from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:176,
from .pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.h:25,
from .pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp:22:
.pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp: In member function 'const __FlashStringHelper* Adafruit_MQTT::connectErrorString(int8_t)':
/Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
.pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp:333:12: note: in expansion of macro 'F'
return F(
^
/Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
.pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp:336:12: note: in expansion of macro 'F'
return F(
^
/Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
.pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp:339:12: note: in expansion of macro 'F'
return F("The MQTT service is unavailable");
^
/Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
.pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp:341:12: note: in expansion of macro 'F'
return F("The data in the user name or password is malformed");
^
/Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
.pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp:343:12: note: in expansion of macro 'F'
return F("Not authorized to connect");
^
/Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
.pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp:345:12: note: in expansion of macro 'F'
return F("Exceeded reconnect rate limit. Please try again later.");
^
/Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
.pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp:347:12: note: in expansion of macro 'F'
return F("You have been banned from connecting. Please contact the MQTT "
^
/Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
.pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp:350:12: note: in expansion of macro 'F'
return F("Connection failed");
^
/Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
.pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp:352:12: note: in expansion of macro 'F'
return F("Failed to subscribe");
^
/Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/WString.h:38:42: error: cannot convert 'const char*' to 'const __FlashStringHelper*' in return
#define F(string_literal) (string_literal)
^
.pio/libdeps/featheresp32/Adafruit MQTT Library/Adafruit_MQTT.cpp:354:12: note: in expansion of macro 'F'
return F("Unknown error");
^
Archiving .pio/build/featheresp32/libc73/libSPIFFS.a
Indexing .pio/build/featheresp32/libc73/libSPIFFS.a
Archiving .pio/build/featheresp32/libc35/libSPI.a
Indexing .pio/build/featheresp32/libc35/libSPI.a
Compiling .pio/build/featheresp32/lib6d3/WiFi101/WiFi.cpp.o
Compiling .pio/build/featheresp32/lib6d3/WiFi101/WiFiClient.cpp.o
Compiling .pio/build/featheresp32/lib6d3/WiFi101/WiFiMDNSResponder.cpp.o
Compiling .pio/build/featheresp32/lib6d3/WiFi101/WiFiSSLClient.cpp.o
*** [.pio/build/featheresp32/lib70f/Adafruit MQTT Library/Adafruit_MQTT.cpp.o] Error 1
In file included from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/sys/unistd.h:23,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/unistd.h:4,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/pthread.h:25,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/pthread.h:21,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/xtensa-esp32-elf/no-rtti/bits/gthr-default.h:48,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/xtensa-esp32-elf/no-rtti/bits/gthr.h:151,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/ext/atomicity.h:35,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/bits/basic_string.h:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/string:52,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/stdexcept:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/array:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/tuple:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/functional:54,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/HardwareSerial.h:49,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:184,
from .pio/libdeps/featheresp32/WiFi101/src/utility/WiFiSocket.h:28,
from .pio/libdeps/featheresp32/WiFi101/src/WiFi.cpp:36:
/Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/sys/unistd.h:30:9: error: conflicting declaration of C function 'int close(int)'
int close (int __fildes);
^~~~~
In file included from .pio/libdeps/featheresp32/WiFi101/src/utility/WiFiSocket.h:24,
from .pio/libdeps/featheresp32/WiFi101/src/WiFi.cpp:36:
.pio/libdeps/featheresp32/WiFi101/src/socket/include/socket.h:1839:15: note: previous declaration 'sint8 close(SOCKET)'
NMI_API sint8 close(SOCKET sock);
^~~~~
In file included from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/sys/unistd.h:23,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/unistd.h:4,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/pthread.h:25,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/pthread.h:21,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/xtensa-esp32-elf/no-rtti/bits/gthr-default.h:48,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/xtensa-esp32-elf/no-rtti/bits/gthr.h:151,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/ext/atomicity.h:35,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/bits/basic_string.h:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/string:52,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/stdexcept:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/array:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/tuple:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/functional:54,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/HardwareSerial.h:49,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:184,
from .pio/libdeps/featheresp32/WiFi101/src/utility/WiFiSocket.h:28,
from .pio/libdeps/featheresp32/WiFi101/src/WiFiClient.cpp:20:
/Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/sys/unistd.h:30:9: error: conflicting declaration of C function 'int close(int)'
int close (int __fildes);
^~~~~
In file included from .pio/libdeps/featheresp32/WiFi101/src/utility/WiFiSocket.h:24,
from .pio/libdeps/featheresp32/WiFi101/src/WiFiClient.cpp:20:
.pio/libdeps/featheresp32/WiFi101/src/socket/include/socket.h:1839:15: note: previous declaration 'sint8 close(SOCKET)'
NMI_API sint8 close(SOCKET sock);
^~~~~
.pio/libdeps/featheresp32/WiFi101/src/WiFi.cpp: In member function 'int WiFiClass::init()':
.pio/libdeps/featheresp32/WiFi101/src/WiFi.cpp:303:36: error: invalid conversion from 'void (*)(uint8_t*, uint32_t)' {aka 'void (*)(unsigned char*, unsigned int)'} to 'tpfAppResolveCb' {aka 'void (*)(unsigned char*, long unsigned int)'} [-fpermissive]
registerSocketCallback(socket_cb, resolve_cb);
^~~~~~~~~~
In file included from .pio/libdeps/featheresp32/WiFi101/src/utility/WiFiSocket.h:24,
from .pio/libdeps/featheresp32/WiFi101/src/WiFi.cpp:36:
.pio/libdeps/featheresp32/WiFi101/src/socket/include/socket.h:1047:79: note: initializing argument 2 of 'void registerSocketCallback(tpfAppSocketCb, tpfAppResolveCb)'
NMI_API void registerSocketCallback(tpfAppSocketCb socket_cb, tpfAppResolveCb resolve_cb);
~~~~~~~~~~~~~~~~^~~~~~~~~~
.pio/libdeps/featheresp32/WiFi101/src/WiFi.cpp: At global scope:
.pio/libdeps/featheresp32/WiFi101/src/WiFi.cpp:1133:10: error: no declaration matches 'uint32_t WiFiClass::getTime()'
uint32_t WiFiClass::getTime()
^~~~~~~~~
In file included from .pio/libdeps/featheresp32/WiFi101/src/WiFi.cpp:38:
.pio/libdeps/featheresp32/WiFi101/src/WiFi101.h:157:16: note: candidate is: 'long unsigned int WiFiClass::getTime()'
unsigned long getTime();
^~~~~~~
.pio/libdeps/featheresp32/WiFi101/src/WiFi101.h:79:7: note: 'class WiFiClass' defined here
class WiFiClass
^~~~~~~~~
*** [.pio/build/featheresp32/lib6d3/WiFi101/WiFi.cpp.o] Error 1
*** [.pio/build/featheresp32/lib6d3/WiFi101/WiFiClient.cpp.o] Error 1
In file included from .pio/libdeps/featheresp32/WiFi101/src/WiFiClient.h:28,
from .pio/libdeps/featheresp32/WiFi101/src/WiFi101.h:35,
from .pio/libdeps/featheresp32/WiFi101/src/WiFiMDNSResponder.h:27,
from .pio/libdeps/featheresp32/WiFi101/src/WiFiMDNSResponder.cpp:32:
.pio/libdeps/featheresp32/WiFi101/src/socket/include/socket.h:1839:15: error: conflicting declaration of C function 'sint8 close(SOCKET)'
NMI_API sint8 close(SOCKET sock);
^~~~~
In file included from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/sys/unistd.h:23,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/unistd.h:4,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/pthread.h:25,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/pthread.h:21,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/xtensa-esp32-elf/no-rtti/bits/gthr-default.h:48,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/xtensa-esp32-elf/no-rtti/bits/gthr.h:151,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/ext/atomicity.h:35,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/bits/basic_string.h:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/string:52,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/stdexcept:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/array:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/tuple:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/functional:54,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/HardwareSerial.h:49,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:184,
from .pio/libdeps/featheresp32/WiFi101/src/WiFiMDNSResponder.cpp:31:
/Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/sys/unistd.h:30:9: note: previous declaration 'int close(int)'
int close (int __fildes);
^~~~~
In file included from .pio/libdeps/featheresp32/WiFi101/src/WiFiClient.h:28,
from .pio/libdeps/featheresp32/WiFi101/src/WiFiSSLClient.h:23,
from .pio/libdeps/featheresp32/WiFi101/src/WiFiSSLClient.cpp:20:
.pio/libdeps/featheresp32/WiFi101/src/socket/include/socket.h:1839:15: error: conflicting declaration of C function 'sint8 close(SOCKET)'
NMI_API sint8 close(SOCKET sock);
^~~~~
In file included from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/sys/unistd.h:23,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/unistd.h:4,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/pthread.h:25,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/newlib/platform_include/pthread.h:21,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/xtensa-esp32-elf/no-rtti/bits/gthr-default.h:48,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/xtensa-esp32-elf/no-rtti/bits/gthr.h:151,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/ext/atomicity.h:35,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/bits/basic_string.h:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/string:52,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/stdexcept:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/array:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/tuple:39,
from /Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/include/c++/8.4.0/functional:54,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/HardwareSerial.h:49,
from /Users/jeremy/.platformio/packages/framework-arduinoespressif32/cores/esp32/Arduino.h:184,
from .pio/libdeps/featheresp32/WiFi101/src/WiFiClient.h:23,
from .pio/libdeps/featheresp32/WiFi101/src/WiFiSSLClient.h:23,
from .pio/libdeps/featheresp32/WiFi101/src/WiFiSSLClient.cpp:20:
/Users/jeremy/.platformio/packages/toolchain-xtensa-esp32/xtensa-esp32-elf/sys-include/sys/unistd.h:30:9: note: previous declaration 'int close(int)'
int close (int __fildes);
^~~~~
*** [.pio/build/featheresp32/lib6d3/WiFi101/WiFiMDNSResponder.cpp.o] Error 1
*** [.pio/build/featheresp32/lib6d3/WiFi101/WiFiSSLClient.cpp.o] Error 1
Here is the example sketch:
#include <WiFi.h>
#include <WiFiClientSecure.h>
#include "Adafruit_MQTT.h"
#include "Adafruit_MQTT_Client.h"
#define AIO_SERVER "x"
#define AIO_USERNAME "x"
#define AIO_KEY "x"
const char *mqtt_root_cert = REDACTED
WiFiClientSecure client;
Adafruit_MQTT_Client mqtt(&client, AIO_SERVER, 8883, AIO_USERNAME, AIO_KEY);
void setup() {
Serial.begin(115200);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("You're connected to the network");
Serial.println();
// MQTT CERT
client.setCACert(mqtt_root_cert);
}
void mqtt_connect(){
int8_t ret;
// Stop if already connected.
if (mqtt.connected()) {
return;
}
Serial.print("Connecting to MQTT... ");
uint8_t retries = 3;
while ((ret = mqtt.connect()) != 0) { // connect will return 0 for connected
Serial.println(mqtt.connectErrorString(ret));
Serial.println("Retrying MQTT connection in 5 seconds...");
mqtt.disconnect();
delay(5000); // wait 5 seconds
retries--;
if (retries == 0) {
// basically die and wait for WDT to reset me
while (1);
}
}
Serial.println("MQTT Connected!");
}
void mqtt_loop(){
// Now we can publish stuff!
Serial.print(F("\nSending val "));
Serial.print(x);
Serial.print(F(" to test feed..."));
if (! test.publish(x++)) {
Serial.println(F("Failed"));
} else {
Serial.println(F("OK!"));
}
// wait a couple seconds to avoid rate limit
delay(2000);
}
void loop() {
mqtt_connect();
mqtt_loop();
}
The text was updated successfully, but these errors were encountered:
Arduino board: featheresp32
Arduino IDE version (found in Arduino -> About Arduino menu): Platform IO
Trying to run the code from the ESP 32 secure example. Compile fails:
Here is the example sketch:
The text was updated successfully, but these errors were encountered: