Hello,
I’m looking at a project (from a friend of mine), he’s stuck.
He wants to use ArduinoIoTCloud and do HTTP requests on an ESP32 (Wemos d1 mini32). But he is always getting the same error:
‘HTTPClient’ was not declared in this scope.
To narrow down the issue, I made an example with minimal code that only includes the ArduinoIoTCloud and the HTTPClient:
//#include <HTTPClient.h> adding or removing this line does not influence the error, it stays
#include <Arduino.h>
#include <WiFi.h>
#include <ArduinoIoTCloud.h>
void setup() {
Serial.begin(115200);
delay(1000);
HTTPClient http; // If this line fails, it’s NOT a conflict — it's core-level missing
Serial.println("HTTPClient works!");
}
void loop() {
}
With following ini:
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:wemos_d1_mini32]
platform = espressif32
board = wemos_d1_mini32
framework = arduino
lib_deps =
arduino-libraries/ArduinoIoTCloud@^2.7.0
lib_ldf_mode = deep+
lib_ignore = WiFiNINA ;Exclude to avoid the PinStatus error ('PinStatus' does not name a type)
;lib_ignore = ArduinoHttpClient does exclude this library but causes errors within ArduinoIoTCloud (OTA for example needs it)
Gives following error:
src/main.cpp: In function 'void setup()':
src/main.cpp:10:3: error: 'HTTPClient' was not declared in this scope
Any ideas?
I already gave him the feedback that he might just need to refactor and use the ArduinoHttpClient (if possible) for requests. Looking at his project all of the request are made to a local webserver, so MQTT would also be a solution. Both of these recommendations are only sidestepping the issue, of course.