Hieromon / AutoConnect

An Arduino library for ESP8266/ESP32 WLAN configuration at runtime with the Web interface

Home Page:https://hieromon.github.io/AutoConnect/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compilation error on ESP32

happy12 opened this issue · comments

The compiler errors out with:
'HTTP_PUT' conflicts with a previous declaration
Under PlatformIO:
[env:esp-wrover-kit]
platform = espressif32
board = esp-wrover-kit
framework = arduino

@happy12
AutoConnect has completed build testing with CI prior to release. HTTP_PUT is an http_method enum value declared by the http_parser.h of ESP32 SDK, but AutoConnect does not explicitly redefine it. Probably a conflict between WebServer.h and HTTPClient.h.

However, I will consider improvements to avoid multiple declarations of the http_method even if the user sketch indirectly includes the http parser. So could you post the following information about your compilation results?
Refs: https://hieromon.github.io/AutoConnect/faq.html#4-reports-the-issue-to-autoconnect-github-repository

  • Version of ESP32 Arduino core
  • Compiler Error messages including compile error location
  • Dependency graph of PlatformIO
  • #incude directives part of your sketch code

Incidentally, this error has been attempted to be fixed by ESP32 Core in the past, but has not been completely avoided due to #include dependencies. Ultimately it's up to the #include directive in the user sketch.

Fixed: espressif/arduino-esp32#4884
Reproduced: espressif/arduino-esp32#7588

maybe it's because I use "ESPAsyncWebServer-esphome" and not "Webserver"?

I don't know. And I have no way of knowing that you were using ESPAsyncWebServer, which was forked to conform to ESPHome.

But it is possible to investigate and determine the cause. Of course you can do it yourself. I need the information commented on here if I will do an investigation. You say that compilation errors occur, but I have seen no evidence.

I am sure that multiple inclusion of http_parser.h is occurring between the libraries you are using. When you include multiple libraries using C++ templates, conflicts between global declarations that do not specify scope are common due to the nature of split compilation. It would not be hard to work around it.

The following SDKs and libraries include http_parser.h. You can find out where this include is derived from.

tools\sdk\esp32\include\esp_http_server\include\esp_http_server.h:
tools\sdk\esp32\include\esp_http_client\include\esp_http_client.h:
libraries\WebServer\src\HTTP_Method.h:

The WebServer library includes HTTP_Method.h, which is fine as long as you have not misplaced WebServer.h include.

Insufficient information provided makes it difficult to continue the survey. Since this is not an AutoConnect issue, I will move to Discussion and await similar reports from other users.