WiFiManager: Incompatibility with ESP32 ESPAsyncWebServer

Basic Infos

Hardware

WiFimanager Branch/Release: Master

Esp8266/Esp32:

Hardware: ESP32 Wroom32

Core Version: tested latest stable and staging

Description

When migrating firmware from using standard WebServer to ESPAsyncWebserver there are conflicts and compile fails

Would be nice if I could still use WiFiManager to provision WLAN and not cook my own!

Settings in IDE

Module: mhetesp32minikit

[env:mhetesp32minikit] platform = espressif32 ; platform_packages = platformio/framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git board = mhetesp32devkit framework = arduino

Additional libraries:

lib_deps = https://github.com/tzapu/WiFiManager.git ESP Async WebServer

Sketch

#BEGIN
#include <Arduino.h>

#include <ESPAsyncWebServer.h>
#include <WiFiManager.h>

AsyncWebServer web_server(80);

void setup() {
    WiFi.mode(WIFI_STA);
    WiFi.hostname("AsyncWiFiManager");

    WiFiManager wm;
    if (!wm.autoConnect(WiFi.getHostname(), WiFi.getHostname())) {
        ESP.restart();
        while (true)
            ;
    }

    web_server.on("/", []( AsyncWebServerRequest *request ) { 
        request->send(200, "text/html", "<html><head><title>Nooo!</title></head><body>WTF :(</body><html>");
    });
    web_server.begin();
}

void loop() {}
#END

Debug Messages

In file included from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/mhetesp32devkit/WiFiManager/WiFiManager.h:94,
                 from src/main.cpp:4:
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:95:6: error: 'HTTP_DELETE' conflicts with a previous declaration
   XX(0,  DELETE,      DELETE)       \
      ^
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~
In file included from src/main.cpp:3:
.pio/libdeps/mhetesp32devkit/ESP Async WebServer/src/ESPAsyncWebServer.h:58:3: note: previous declaration 'WebRequestMethod HTTP_DELETE'
   HTTP_DELETE  = 0b00000100,
   ^~~~~~~~~~~
In file included from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/mhetesp32devkit/WiFiManager/WiFiManager.h:94,
                 from src/main.cpp:4:
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:96:6: error: 'HTTP_GET' conflicts with a previous declaration
   XX(1,  GET,         GET)          \
      ^
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~
In file included from src/main.cpp:3:
.pio/libdeps/mhetesp32devkit/ESP Async WebServer/src/ESPAsyncWebServer.h:56:3: note: previous declaration 'WebRequestMethod HTTP_GET'
   HTTP_GET     = 0b00000001,
   ^~~~~~~~
In file included from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/mhetesp32devkit/WiFiManager/WiFiManager.h:94,
                 from src/main.cpp:4:
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:97:6: error: 'HTTP_HEAD' conflicts with a previous declaration
   XX(2,  HEAD,        HEAD)         \
      ^
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~
In file included from src/main.cpp:3:
.pio/libdeps/mhetesp32devkit/ESP Async WebServer/src/ESPAsyncWebServer.h:61:3: note: previous declaration 'WebRequestMethod HTTP_HEAD'
   HTTP_HEAD    = 0b00100000,
   ^~~~~~~~~
In file included from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/mhetesp32devkit/WiFiManager/WiFiManager.h:94,
                 from src/main.cpp:4:
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:98:6: error: 'HTTP_POST' conflicts with a previous declaration
   XX(3,  POST,        POST)         \
      ^
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~
In file included from src/main.cpp:3:
.pio/libdeps/mhetesp32devkit/ESP Async WebServer/src/ESPAsyncWebServer.h:57:3: note: previous declaration 'WebRequestMethod HTTP_POST'
   HTTP_POST    = 0b00000010,
   ^~~~~~~~~
In file included from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/mhetesp32devkit/WiFiManager/WiFiManager.h:94,
                 from src/main.cpp:4:
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:99:6: error: 'HTTP_PUT' conflicts with a previous declaration
   XX(4,  PUT,         PUT)          \
      ^
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~
In file included from src/main.cpp:3:
.pio/libdeps/mhetesp32devkit/ESP Async WebServer/src/ESPAsyncWebServer.h:59:3: note: previous declaration 'WebRequestMethod HTTP_PUT'
   HTTP_PUT     = 0b00001000,
   ^~~~~~~~
In file included from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/mhetesp32devkit/WiFiManager/WiFiManager.h:94,
                 from src/main.cpp:4:
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:102:6: error: 'HTTP_OPTIONS' conflicts with a previous declaration
   XX(6,  OPTIONS,     OPTIONS)      \
      ^
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~
In file included from src/main.cpp:3:
.pio/libdeps/mhetesp32devkit/ESP Async WebServer/src/ESPAsyncWebServer.h:62:3: note: previous declaration 'WebRequestMethod HTTP_OPTIONS'
   HTTP_OPTIONS = 0b01000000,
   ^~~~~~~~~~~~
In file included from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/HTTP_Method.h:4,
                 from /home/joachim/.platformio/packages/framework-arduinoespressif32/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/mhetesp32devkit/WiFiManager/WiFiManager.h:94,
                 from src/main.cpp:4:
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:128:6: error: 'HTTP_PATCH' conflicts with a previous declaration
   XX(28, PATCH,       PATCH)        \
      ^~
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:138:45: note: in definition of macro 'XX'
 #define XX(num, name, string) HTTP_##name = num,
                                             ^~~
/home/joachim/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:139:3: note: in expansion of macro 'HTTP_METHOD_MAP'
   HTTP_METHOD_MAP(XX)
   ^~~~~~~~~~~~~~~
In file included from src/main.cpp:3:
.pio/libdeps/mhetesp32devkit/ESP Async WebServer/src/ESPAsyncWebServer.h:60:3: note: previous declaration 'WebRequestMethod HTTP_PATCH'
   HTTP_PATCH   = 0b00010000,
   ^~~~~~~~~~

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16

Most upvoted comments

Found yet another “solution”:

include WiFiManager first. ESPAsyncWebServer is already prepared to not redefine the conflicting symbols if the standard webserver is already included.

the bind error remains though…