arduino-libraries / ArduinoHttpClient

Arduino HTTP Client library
288 stars 172 forks source link

HttpClient object name conflicting with AutoConnect.h on ESP32 #157

Open 379ptp4ms opened 1 year ago

379ptp4ms commented 1 year ago

Can't compile a project containing both ArduinoHttpClient and AutoConnect libraries, due to what seems as a naming conflict. Build log below:

Compiling .pio\build\esp32-c3-devkitc-02\lib42c\EspSoftwareSerial\SoftwareSerial.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\lib43b\ArduinoHttpClient\HttpClient.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\lib43b\ArduinoHttpClient\URLEncoder.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\lib43b\ArduinoHttpClient\WebSocketClient.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\lib43b\ArduinoHttpClient\b64.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\libbf2\FS\FS.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\libbf2\FS\vfs_api.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\lib840\LittleFS\LittleFS.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\libad3\SPIFFS\SPIFFS.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\lib863\WiFi\WiFi.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\lib863\WiFi\WiFiAP.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\lib863\WiFi\WiFiClient.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\lib863\WiFi\WiFiGeneric.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\lib863\WiFi\WiFiMulti.cpp.o
Archiving .pio\build\esp32-c3-devkitc-02\lib43b\libArduinoHttpClient.a
Compiling .pio\build\esp32-c3-devkitc-02\lib863\WiFi\WiFiSTA.cpp.o
Archiving .pio\build\esp32-c3-devkitc-02\lib42c\libEspSoftwareSerial.a
Compiling .pio\build\esp32-c3-devkitc-02\lib863\WiFi\WiFiScan.cpp.o
Compiling .pio\build\esp32-c3-devkitc-02\lib863\WiFi\WiFiServer.cpp.o
Archiving .pio\build\esp32-c3-devkitc-02\libbf2\libFS.a
Archiving .pio\build\esp32-c3-devkitc-02\lib840\libLittleFS.a
In file included from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnectUpdate.h:45,
                 from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnectExt.hpp:24,
                 from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnectExtImpl.hpp:13,
                 from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnect.h:15,
                 from src/main.cpp:5:
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:56:48: error: 'HTTPClient' was not declared in this scope
 using HTTPUpdateRequestCB = std::function<void(HTTPClient*)>;
                                                ^~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:56:48: note: suggested alternative: 'HttpClient'
 using HTTPUpdateRequestCB = std::function<void(HTTPClient*)>;
                                                ^~~~~~~~~~
                                                HttpClient
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:56:60: error: template argument 1 is invalid
 using HTTPUpdateRequestCB = std::function<void(HTTPClient*)>;
                                                            ^
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:77:29: error: 'followRedirects_t' has not been declared
     void setFollowRedirects(followRedirects_t follow)
                             ^~~~~~~~~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:88:106: error: 'HTTPUpdateRequestCB' has not been declared
     t_httpUpdate_return update(WiFiClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                          ^~~~~~~~~~~~~~~~~~~
In file included from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnectUpdate.h:45,
                 from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnectExt.hpp:24,
                 from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnectExtImpl.hpp:13,
                 from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnect.h:15,
                 from src/main.cpp:5:
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:91:67: error: 'HTTPUpdateRequestCB' has not been declared
                                const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                   ^~~~~~~~~~~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:93:112: error: 'HTTPUpdateRequestCB' has not been declared
     t_httpUpdate_return updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
Compiling .pio\build\esp32-c3-devkitc-02\lib863\WiFi\WiFiUdp.cpp.o
                                                                                                                ^~~~~~~~~~~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:95:32: error: 'HTTPClient' has not been declared
     t_httpUpdate_return update(HTTPClient& httpClient,
                                ^~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:97:32: error: 'HTTPUpdateRequestCB' has not been declared
                                HTTPUpdateRequestCB requestCB = NULL);
                                ^~~~~~~~~~~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:99:38: error: 'HTTPClient' has not been declared
     t_httpUpdate_return updateSpiffs(HTTPClient &httpClient, const String &currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                      ^~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:99:97: error: 'HTTPUpdateRequestCB' has not been declared
     t_httpUpdate_return updateSpiffs(HTTPClient &httpClient, const String &currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                 ^~~~~~~~~~~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:111:38: error: 'HTTPClient' has not been declared
     t_httpUpdate_return handleUpdate(HTTPClient& http, const String& currentVersion, bool spiffs = false, HTTPUpdateRequestCB requestCB = NULL);
                                      ^~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:111:107: error: 'HTTPUpdateRequestCB' has not been declared
     t_httpUpdate_return handleUpdate(HTTPClient& http, const String& currentVersion, bool spiffs = false, HTTPUpdateRequestCB requestCB = NULL);
                                                                                                           ^~~~~~~~~~~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:125:5: error: 'followRedirects_t' does not name a type
     followRedirects_t _followRedirects;
     ^~~~~~~~~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:88:138: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
     t_httpUpdate_return update(WiFiClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                                                          ^~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:91:99: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
                                const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                   ^~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:93:144: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
     t_httpUpdate_return updateSpiffs(WiFiClient& client, const String& url, const String& currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                                                                ^~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:97:64: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
                                HTTPUpdateRequestCB requestCB = NULL);
                                                                ^~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:99:129: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
     t_httpUpdate_return updateSpiffs(HTTPClient &httpClient, const String &currentVersion = "", HTTPUpdateRequestCB requestCB = NULL);
                                                                                                                                 ^~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:111:139: warning: converting to non-pointer type 'int' from NULL [-Wconversion-null]
     t_httpUpdate_return handleUpdate(HTTPClient& http, const String& currentVersion, bool spiffs = false, HTTPUpdateRequestCB requestCB = NULL);
                                                                                                                                           ^~~~
In file included from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnectUpdate.h:45,
                 from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnectExt.hpp:24,
                 from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnectExtImpl.hpp:13,
                 from .pio/libdeps/esp32-c3-devkitc-02/AutoConnect/src/AutoConnect.h:15,
                 from src/main.cpp:5:
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h: In member function 'void HTTPUpdate::setFollowRedirects(int)':
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:79:9: error: '_followRedirects' was not declared in this scope
         _followRedirects = follow;
         ^~~~~~~~~~~~~~~~
C:/Users/xxx/.platformio/packages/framework-arduinoespressif32/libraries/HTTPUpdate/src/HTTPUpdate.h:79:9: note: suggested alternative: 'setFollowRedirects'
         _followRedirects = follow;
         ^~~~~~~~~~~~~~~~
         setFollowRedirects
Compiling .pio\build\esp32-c3-devkitc-02\lib8d3\WebServer\Parsing.cpp.o
*** [.pio\build\esp32-c3-devkitc-02\src\main.cpp.o] Error 1
379ptp4ms commented 1 year ago

Managed to resolve the issue by renaming every instance of "HttpClient" in ArduinoHttpClient/src to "MyClient" - including objects, filenames etc and using the modified library as a local one in platformio, confirming that it's just a naming issue. I'm including the modified library as a .zip file. Modified_ArduinoHttpClient.zip