Why do i have multiple WiFi definitions

trying to use a new board (for me) esp8266 vs esp32.
thought i found a web page describing what new libraries i needed

but i'm getting the following errors and am confused, both why there are multiple definitions and why there's a .a file being described.

not sure i'm explaining this well enough to be answered ... what else is needed?

c:/users/lenovo/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient5writeEh':

C:\Users\lenovo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:207: multiple definition of `_ZN10WiFiClient5writeEh'; libraries\WiFi-1.2.7\WiFiClient.cpp.o:C:\Users\lenovo\Documents\Arduinop\libraries\WiFi-1.2.7\src/WiFiClient.cpp:74: first defined here

if you want to use ESPAsyncWebServer you need different libraries for an ESP32 versus ESP8266

start your code with this

#ifdef ESP32
#include <WiFi.h>
#include <AsyncTCP.h>
#elif defined(ESP8266)
#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#endif
#include <ESPAsyncWebServer.h>

AsyncWebServer server(80);

and it will adjust to the platform

or of course if you only want the ESP8266 then you need

#include <ESP8266WiFi.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>

ESPAsyncWebServer for ESP8266 it requires ESPAsyncTCP To use this library you might need to have the latest git versions of ESP8266 Arduino Core

ESPAsyncWebServer for ESP32 it requires AsyncTCP to work To use this library you might need to have the latest git versions of ESP32 Arduino Core

How do you "get" the latest version? Is it the latest one offered by the Board Manager?

yes, if you have the right URI (https://arduino.esp8266.com/stable/package_esp8266com_index.json) in the preferences

for the ESP32

Thanks

that made sense and cleared up some other mysteries but still getting

c:/users/lenovo/appdata/local/arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/3.0.4-gcc10.3-1757bed/bin/../lib/gcc/xtensa-lx106-elf/10.3.0/../../../../xtensa-lx106-elf/bin/ld.exe: libraries\ESP8266WiFi\ESP8266WiFi.a(WiFiClient.cpp.o): in function `_ZN10WiFiClient5writeEh':

C:\Users\lenovo\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.0.2\libraries\ESP8266WiFi\src/WiFiClient.cpp:207: multiple definition of `_ZN10WiFiClient5writeEh'; libraries\WiFi-1.2.7\WiFiClient.cpp.o:C:\Users\lenovo\Documents\Arduinop\libraries\WiFi-1.2.7\src/WiFiClient.cpp:74: first defined here

did i screw things up installing WiFi_1.2.7?

You could delete the esp8266 directory and install again but before What happens is you try to compile this example?

thanks much.
that compiled/loaded w/o error

great

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.