I'm not sure if this is the right place to post this, but I'm trying to get this code to work, and I don't understand the error output and what's it's trying to tell me. I have project "A" which is "WiFiManager"-based, and project "B" which is not. Both projects compile successfully on their own in both Arduino IDE's 1.8 & 2.x.
But when I try and incorporate "WIFIMANAGER" into project "B" things fall apart. I'm going to paste the code & error messages here and hopefully someone can help....let me know if you need the actual html code, which resides in SPIFFS. Otherwise tell me where I should post this for better assistance. Thanks in advance!!!!
Within this code if "WIFIMANAGER" is NOT defined, project "B" works fine, once it is defined, errors!
#define WIFIMANAGER
// Import required libraries
#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#include <SPIFFS.h>
#ifndef WIFIMANAGER
// Replace with your network credentials
const char* ssid = "yourssid";
const char* password = "yourpassword";
#else
#include <WiFiManager.h>
WiFiManager wm;
#endif
// Create AsyncWebServer object on port 80
AsyncWebServer server(80);
bool wifi_enabled = 1;
String getRandomData() {
float t = rand() % 100;
Serial.println(t);
return String(t);
}
void setup(){
// Serial port for debugging purposes
Serial.begin(115200);
// Initialize SPIFFS
if(!SPIFFS.begin()){
Serial.println("An Error has occurred while mounting SPIFFS");
return;
}
#ifndef WIFIMANAGER
// Connect to Wi-Fi
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.println("Connecting to WiFi..");
}
// Print ESP32 Local IP Address
Serial.println(WiFi.localIP());
#else
//*******************Wifi Manager Mode *************************//
WiFi.mode(WIFI_STA); // explicitly set mode, esp defaults to STA+AP
// it is a good practice to make sure your code sets wifi mode how you want it.
//WiFiManager, Local intialization. Once its business is done, there is no need to keep it around
// reset settings - wipe stored credentials for testing
// these are stored by the esp library
//wm.resetSettings();
// Automatically connect using saved credentials,
// if connection fails, it starts an access point with the specified name ( "AutoConnectAP"),
// if empty will auto generate SSID, if password is blank it will be anonymous AP (wm.autoConnect())
// then goes into a blocking loop awaiting configuration and will return success result
bool res;
res = wm.autoConnect("XDT2AutoConnect"); // anonymous ap
if(!res)
{
Serial.println("Failed to connect");
}
else {
//if you get here you have connected to the WiFi
Serial.println("connected...yeey ");
wifi_enabled = 1;
}
#endif
//*******************Wifi Manager Mode *************************//
// Route for root / web page
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SPIFFS, "/index.html");
});
server.on("/logo", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(SPIFFS, "/logo.png", "image/png");
});
server.on("/temperature", HTTP_GET, [](AsyncWebServerRequest *request){
request->send_P(200, "text/plain", getRandomData().c_str());
});
// Start server
server.begin();
}
void loop(){
}
ERROR MESSAGES:
In file included from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/HTTP_Method.h:4,
from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/WebServer.h:30,
from c:\Users\user\documents\Sketches\libraries\WiFiManager/WiFiManager.h:94,
from C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:24:
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:95:6: error: 'HTTP_DELETE' conflicts with a previous declaration
XX(0, DELETE, DELETE) \
^
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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,
^~~
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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 C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:16:
c:\Users\user\documents\Sketches\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:64:3: note: previous declaration 'WebRequestMethod HTTP_DELETE'
HTTP_DELETE = 0b00000100,
^~~~~~~~~~~
In file included from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/HTTP_Method.h:4,
from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/WebServer.h:30,
from c:\Users\user\documents\Sketches\libraries\WiFiManager/WiFiManager.h:94,
from C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:24:
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:96:6: error: 'HTTP_GET' conflicts with a previous declaration
XX(1, GET, GET) \
^
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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,
^~~
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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 C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:16:
c:\Users\user\documents\Sketches\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:62:3: note: previous declaration 'WebRequestMethod HTTP_GET'
HTTP_GET = 0b00000001,
^~~~~~~~
In file included from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/HTTP_Method.h:4,
from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/WebServer.h:30,
from c:\Users\user\documents\Sketches\libraries\WiFiManager/WiFiManager.h:94,
from C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:24:
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:97:6: error: 'HTTP_HEAD' conflicts with a previous declaration
XX(2, HEAD, HEAD) \
^
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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,
^~~
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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 C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:16:
c:\Users\user\documents\Sketches\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:67:3: note: previous declaration 'WebRequestMethod HTTP_HEAD'
HTTP_HEAD = 0b00100000,
^~~~~~~~~
In file included from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/HTTP_Method.h:4,
from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/WebServer.h:30,
from c:\Users\user\documents\Sketches\libraries\WiFiManager/WiFiManager.h:94,
from C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:24:
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:98:6: error: 'HTTP_POST' conflicts with a previous declaration
XX(3, POST, POST) \
^
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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,
^~~
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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 C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:16:
c:\Users\user\documents\Sketches\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:63:3: note: previous declaration 'WebRequestMethod HTTP_POST'
HTTP_POST = 0b00000010,
^~~~~~~~~
In file included from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/HTTP_Method.h:4,
from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/WebServer.h:30,
from c:\Users\user\documents\Sketches\libraries\WiFiManager/WiFiManager.h:94,
from C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:24:
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:99:6: error: 'HTTP_PUT' conflicts with a previous declaration
XX(4, PUT, PUT) \
^
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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,
^~~
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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 C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:16:
c:\Users\user\documents\Sketches\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:65:3: note: previous declaration 'WebRequestMethod HTTP_PUT'
HTTP_PUT = 0b00001000,
^~~~~~~~
In file included from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/HTTP_Method.h:4,
from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/WebServer.h:30,
from c:\Users\user\documents\Sketches\libraries\WiFiManager/WiFiManager.h:94,
from C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:24:
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:102:6: error: 'HTTP_OPTIONS' conflicts with a previous declaration
XX(6, OPTIONS, OPTIONS) \
^
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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,
^~~
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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 C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:16:
c:\Users\user\documents\Sketches\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:68:3: note: previous declaration 'WebRequestMethod HTTP_OPTIONS'
HTTP_OPTIONS = 0b01000000,
^~~~~~~~~~~~
In file included from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/HTTP_Method.h:4,
from C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\WebServer\src/WebServer.h:30,
from c:\Users\user\documents\Sketches\libraries\WiFiManager/WiFiManager.h:94,
from C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:24:
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/tools/sdk/esp32/include/nghttp/port/include/http_parser.h:128:6: error: 'HTTP_PATCH' conflicts with a previous declaration
XX(28, PATCH, PATCH) \
^~
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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,
^~~
C:\Users\user\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11/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 C:\Users\user\documents\Sketches\XDTII\DemoForZeb_230620\XDTIIApp_230724\ESP_Chart_Web_Server\ESP_Chart_Web_Server.ino:16:
c:\Users\user\documents\Sketches\libraries\ESPAsyncWebServer-master\src/ESPAsyncWebServer.h:66:3: note: previous declaration 'WebRequestMethod HTTP_PATCH'
HTTP_PATCH = 0b00010000,
^~~~~~~~~~
exit status 1
Compilation error: exit status 1
Mixing WiFi modes
Jump to
- English Forum
- Explore
- News
- General Discussion
- FAQ
- Documentation
- Documentation
- Sample Code
- Discussion Forum
- Hardware
- ESP-IDF
- ESP-BOX
- ESP-ADF
- ESP-MDF
- ESP-WHO
- ESP-SkaiNet
- ESP32 Arduino
- IDEs for ESP-IDF
- ESP-AT
- ESP IoT Solution
- ESP RainMaker
- Rust
- ESP8266
- Report Bugs
- Showcase
- Chinese Forum 中文社区
- 活动区
- 乐鑫活动专区
- 讨论区
- 全国大学生物联网设计竞赛乐鑫答疑专区
- ESP-IDF 中文讨论版
- 《ESP32-C3 物联网工程开发实战》书籍讨论版
- 中文文档讨论版
- ESP-AT 中文讨论版
- ESP-BOX 中文讨论版
- ESP IoT Solution 中文讨论版
- ESP-ADF 中文讨论版
- ESP Mesh 中文讨论版
- ESP Cloud 中文讨论版
- ESP-WHO 中文讨论版
- ESP-SkaiNet 中文讨论版
- ESP 生产支持讨论版
- 硬件问题讨论
- 项目展示
Who is online
Users browsing this forum: No registered users and 37 guests
- All times are UTC
- Top
- Delete cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. ESP8266EX and ESP32 are some of our products.