c++arduinoesp8266

I am facing 'HTTP_GET' conflicts with a previous declaration error with the WifiManager lib, when i tried to include in my up and running code


This is my header file

#include <DNSServer.h>
#include <ESP8266WebServer.h>
#include <WiFiManager.h>
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
#include <ESP8266mDNS.h>
#include <ArduinoOTA.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#include <SoftwareSerial.h> 
#include <dds238.h>

I am using ESPAsyncWebServer.h for the jsonrequest to send the data to my ip. and i am using WifiManger to automate the wifi connection so i do not need to hardocode the wifi credentials, however for this i have to use ESP8266WebServer.h along with WiFiManager.h. I am stuck in this for over one week. The error i am getting:

In file included from src\main.cpp:31:
.pio\libdeps\esp12e\ESPAsyncWebServer-esphome\src/ESPAsyncWebServer.h:62:18: error: 'HTTP_GET' conflicts with a previous declaration
   62 |   HTTP_GET     = 0b00000001,

Solution

  • You don't have to provide in your sketch the includes for libraries used by other libraries. The WiFiManager library includes its dependencies and the Arduino build system will detect the libraries.

    Remove #include <ESP8266WebServer.h> to avoid the conflict with the HTTP_GET enum value from ESP8266WebServer library.