khoih-prog / ESPAsync_WiFiManager

This is an ESP32 (including ESP32-S2 and ESP32-C3) / ESP8266 WiFi Connection Manager, using ESPAsyncWebServer, with fallback web configuration portal. Use this library for configuring ESP32, ESP8266 modules' WiFi, etc. Credentials at runtime. You can also specify static DNS servers, personalized HostName, fixed or random AP WiFi channel. With examples supporting ArduinoJson 6.0.0+ as well as 5.13.5- . Using AsyncDNSServer instead of DNSServer now.
MIT License
290 stars 73 forks source link

Possible dependency Error #120

Closed fow0ryl closed 1 year ago

fow0ryl commented 1 year ago

Installed a fresh platformio on manjaro linux yesterday. Then I have build an example from ESPAsync_WiFiManager_lite for my ESP32 Devkit V1 without problems. Now I'm trying to build the example "Async_Autoconnect" with ESPAsync_WiFiManager. But this did not work :( After adding ESPAsync_WiFiManager to libaries I added ESPAsync_WiFiManager to platformio.ini. and trying to build, I got this: Compiling .pio/build/esp32doit-devkit-v1/libfdc/AsyncTCP/AsyncTCP.cpp.o In file included from .pio/libdeps/esp32doit-devkit-v1/ESPAsync_WiFiManager/src/ESPAsync_WiFiManager.h:41, from src/main.cpp:283: .pio/libdeps/esp32doit-devkit-v1/ESPAsync_WiFiManager/src/ESPAsync_WiFiManager.hpp:222:10: fatal error: ESPAsyncDNSServer.h: No such file or directory

Ok. after adding "devyte/ESPAsyncDNSServer @ ^1.0.0" to platformio.ini I got the next error :( In file included from .pio/libdeps/esp32doit-devkit-v1/ESPAsync_WiFiManager/src/ESPAsync_WiFiManager.hpp:222, from .pio/libdeps/esp32doit-devkit-v1/ESPAsync_WiFiManager/src/ESPAsync_WiFiManager.h:41, from src/main.cpp:283: .pio/libdeps/esp32doit-devkit-v1/ESPAsyncDNSServer/src/ESPAsyncDNSServer.h:4:10: fatal error: ESPAsyncUDP.h: No such file or directory

When looking around to find a library, I can only find "me-no-dev/ESPAsyncUDP". But this is a library for ESP8266 only. I give it a try, but it did not work. In file included from .pio/libdeps/esp32doit-devkit-v1/ESPAsyncDNSServer/src/ESPAsyncDNSServer.h:4, from .pio/libdeps/esp32doit-devkit-v1/ESPAsync_WiFiManager/src/ESPAsync_WiFiManager.hpp:222, from .pio/libdeps/esp32doit-devkit-v1/ESPAsync_WiFiManager/src/ESPAsync_WiFiManager.h:41, from src/main.cpp:283: .pio/libdeps/esp32doit-devkit-v1/ESPAsyncUDP/src/ESPAsyncUDP.h:19:25: error: conflicting declaration 'typedef struct ip4_addr ip_addr_t' typedef struct ip4_addr ip_addr_t;

How to solve the problem?

khoih-prog commented 1 year ago

From

  1. https://github.com/devyte/ESPAsyncDNSServer/blob/master/src/ESPAsyncDNSServer.h#L4-L11

or

  1. https://github.com/khoih-prog/ESPAsyncDNSServer/blob/master/src/ESPAsyncDNSServer.h#L4-L11
#ifdef ARDUINO_ARCH_ESP32
  #ifndef Stream_h
    #include <Stream.h>
  #endif
  #include <AsyncUDP.h>
#else
  #include <ESPAsyncUDP.h>
#endif

fatal error: ESPAsyncUDP.h: No such file or directory

It seems PIO didn't select the library correctly in complex cases. ESP32 => AsyncUDP, not ESPAsyncUDP library

Post an issue on PIO so that the bug can be fixed.

Just temporarily modify manually to force PIO to use AsyncUDP

//#ifdef ARDUINO_ARCH_ESP32
  #ifndef Stream_h
    #include <Stream.h>
  #endif
  #include <AsyncUDP.h>
//#else
  //#include <ESPAsyncUDP.h>
//#endif

Try the old-yet-stable Arduino IDE first, especially in complex use-cases, to verify it's OK before moving to PIO, to be sure you've done everything correctly.

Selection_174


This is not the bug or issue of this library, and I'm closing it now.

Good Luck,