Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't compile example - error: 'HTTP_DELETE' conflicts with a previous declaration #241

Open
yanxke opened this issue Dec 26, 2024 · 0 comments

Comments

@yanxke
Copy link

yanxke commented Dec 26, 2024

platformio.ini:

[env:wemos_d1_mini32]
platform = espressif32
board = wemos_d1_mini32
framework = arduino
lib_deps = mathieucarbou/ESPAsyncWebServer@^3.4.5
   ayushsharma82/ElegantOTA@^3.1.6

main.cpp:

#include <Arduino.h>

#if defined(ESP8266)
#include <ESP8266WiFi.h>
#elif defined(ESP32)
#include <WiFi.h>
#endif

#include <ESPAsyncWebServer.h>
#include <ElegantOTA.h>

const char *ssid = "A";
const char *password = "B";

AsyncWebServer server(80);

unsigned long ota_progress_millis = 0;

void onOTAStart()
{
    // Log when OTA has started
    Serial.println("OTA update started!");
    // <Add your own code here>
}

void onOTAProgress(size_t current, size_t final)
{
    // Log every 1 second
    if (millis() - ota_progress_millis > 1000)
    {
        ota_progress_millis = millis();
        Serial.printf("OTA Progress Current: %u bytes, Final: %u bytes\n", current, final);
    }
}

void onOTAEnd(bool success)
{
    // Log when OTA has finished
    if (success)
    {
        Serial.println("OTA update finished successfully!");
    }
    else
    {
        Serial.println("There was an error during OTA update!");
    }
    // <Add your own code here>
}

void setup()
{
    // Initialize the serial port
    Serial.begin(9600);
    // Initialize the LED pin as an output
    pinMode(LED_BUILTIN, OUTPUT);

    WiFi.mode(WIFI_STA);
    WiFi.begin(ssid, password);
    Serial.println("");

    // Wait for connection
    while (WiFi.status() != WL_CONNECTED)
    {
        delay(500);
        Serial.print(".");
    }
    Serial.println("");
    Serial.print("Connected to ");
    Serial.println(ssid);
    Serial.print("IP address: ");
    Serial.println(WiFi.localIP());

    server.on("/", HTTP_GET, [](AsyncWebServerRequest *request)
              { request->send(200, "text/plain", "Hi! This is ElegantOTA AsyncDemo."); });

    ElegantOTA.begin(&server); // Start ElegantOTA
    // ElegantOTA callbacks
    ElegantOTA.onStart(onOTAStart);
    ElegantOTA.onProgress(onOTAProgress);
    ElegantOTA.onEnd(onOTAEnd);

    server.begin();
    Serial.println("HTTP server started");
}

void loop()
{
    ElegantOTA.loop();
}

Error:

In file included from C:/Users/X/.platformio/packages/framework-arduinoespressif32@src-0c9bc5a2e917d2a24b2fba29cb704cc7/libraries/WebServer/src/HTTP_Method.h:4,
                 from C:/Users/X/.platformio/packages/framework-arduinoespressif32@src-0c9bc5a2e917d2a24b2fba29cb704cc7/libraries/WebServer/src/WebServer.h:30,
                 from .pio/libdeps/wemos_d1_mini32/ElegantOTA/src/ElegantOTA.h:73,
                 from src/main.cpp:10:
C:/Users/X/.platformio/packages/framework-arduinoespressif32-libs/esp32/include/http_parser/http_parser.h:95:6: error: 'HTTP_DELETE' conflicts with a previous declaration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant