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

ESP32 HttpClient compile error #173

Closed
mikeysklar opened this issue Jan 6, 2025 · 1 comment
Closed

ESP32 HttpClient compile error #173

mikeysklar opened this issue Jan 6, 2025 · 1 comment

Comments

@mikeysklar
Copy link

Forum issue with ESP32 BSP 3.1.0 no longer compiling with basic AdafruitIO_WiFi constructor being used. The previous ESP32 BSP 3.0.7 works fine.

I set the board to Feather ESP32 v2, but any ESP32 will likely show the same response.

minimum viable code (thx paolometeo):

#include <SPI.h>
#include <Wire.h>
#include <WiFiManager.h>
#include "AdafruitIO_WiFi.h"
#include <Preferences.h>

// Replace these with your actual Adafruit IO credentials and WiFi details
#define IO_USERNAME    "your_username"
#define IO_KEY         "your_aio_key"
#define WIFI_SSID      "your_wifi_ssid"
#define WIFI_PASS      "your_wifi_password"

// Initialize Adafruit IO with WiFi
AdafruitIO_WiFi io(IO_USERNAME, IO_KEY, WIFI_SSID, WIFI_PASS);

void setup(){}
void loop(){}

error message:

/Users/sklarm/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/wifi/AdafruitIO_ESP32.cpp: In constructor 'AdafruitIO_ESP32::AdafruitIO_ESP32(const char*, const char*, const char*, const char*)':
/Users/sklarm/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/wifi/AdafruitIO_ESP32.cpp:25:53: error: invalid new-expression of abstract class type 'HttpClient'
   25 |   _http = new HttpClient(*_client, _host, _http_port);
      |                                                     ^
In file included from /Users/sklarm/Documents/Arduino/libraries/ArduinoHttpClient/src/ArduinoHttpClient.h:8,
                 from /Users/sklarm/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO.h:27,
                 from /Users/sklarm/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/wifi/AdafruitIO_ESP32.h:20,
                 from /Users/sklarm/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/wifi/AdafruitIO_ESP32.cpp:16:
/Users/sklarm/Documents/Arduino/libraries/ArduinoHttpClient/src/HttpClient.h:41:7: note:   because the following virtual functions are pure within 'HttpClient':
   41 | class HttpClient : public Client
      |       ^~~~~~~~~~
In file included from /Users/sklarm/Library/Arduino15/packages/esp32/hardware/esp32/3.1.0/cores/esp32/Arduino.h:197,
                 from /Users/sklarm/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO_Dashboard.h:19,
                 from /Users/sklarm/Documents/Arduino/libraries/Adafruit_IO_Arduino/src/AdafruitIO.h:19:
/Users/sklarm/Library/Arduino15/packages/esp32/hardware/esp32/3.1.0/cores/esp32/Client.h:29:15: note:     'virtual int Client::connect(IPAddress, uint16_t, int32_t)'
   29 |   virtual int connect(IPAddress ip, uint16_t port, int32_t timeout) = 0;
      |               ^~~~~~~
/Users/sklarm/Library/Arduino15/packages/esp32/hardware/esp32/3.1.0/cores/esp32/Client.h:31:15: note:     'virtual int Client::connect(const char*, uint16_t, int32_t)'
   31 |   virtual int connect(const char *host, uint16_t port, int32_t timeout) = 0;
      |               ^~~~~~~
Multiple libraries were found for "WiFi.h"
  Used: /Users/sklarm/Library/Arduino15/packages/esp32/hardware/esp32/3.1.0/libraries/WiFi
  Not used: /Users/sklarm/Documents/Arduino/libraries/WiFiNINA
+---------------------------+----------------------+
| Name                      | Version              |
+---------------------------+----------------------+
| macOS Ventura             | 13.6.7               |
| Arduino IDE               | 2.3.4                |
| WiFi                      | 3.0.7                |
| SPI                       | 3.0.7                |
| Wire                      | 3.0.7                |
| WiFiManager               | 2.0.17               |
| Networking                | 3.0.7                |
| Update                    | 3.0.7                |
| WebServer                 | 3.0.7                |
| FS                        | 3.0.7                |
| DNSServer                 | 3.0.7                |
| ESP32 Async UDP           | 3.0.7                |
| Adafruit IO Arduino       | 4.3.0                |
| Adafruit MQTT Library     | 2.5.8                |
| ArduinoHttpClient         | 0.6.1                |
| NetworkClientSecure       | 3.0.7                |
| Preferences               | 3.0.7                |
+---------------------------+----------------------+
@brentru
Copy link
Member

brentru commented Jan 9, 2025

@mikeysklar Hi, thank you for the bug report!

This is directly related to arduino-libraries/ArduinoHttpClient#182

A PR has been merged to revert the breaking change in the esp32 platform's Client API: espressif/arduino-esp32#10776

This has been released as part of Arduino ESP32 BSP v3.1.1 based on ESP-IDF v5.3.2 - https://github.com/espressif/arduino-esp32/releases/tag/3.1.1

Please instruct any forum user experiencing issues to update to the latest version of ESP32 BSP, 3.1.1 or above.

@brentru brentru closed this as completed Jan 9, 2025
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

2 participants