Can't Compile My Code - ESP32 on Arduino Framework

Hello Everybody,
I Have a previously working project that’s not working (Compiling) anymore since the last PIO update.
i’m using ESP32 and Arduino as its framework.
Errors are usually library/directory not found.

1 Like

Did you update the libraries via PIO or the PIO core? Can create a minimal project or your current project with the exact error messages for reproduction?

2 Likes

Thanks for the reply,
i updated PIO itself, have been working on this project 2 months ago and it worked like charm.
actually it was on production and uploaded on multiple controllers.

I’ve Solved Some Errors Updating the intellisense, but those are still unsolvable:

rc\main.cpp: In function 'int QR_String_Get()':
src\main.cpp:175:5: error: 'HTTPClient' was not declared in this scope
HTTPClient http2;
^
src\main.cpp:181:9: error: 'http2' was not declared in this scope
http2.begin(Http_URL); //Specify the URL
^
src\main.cpp: In function 'void QR_Code_Print()':
src\main.cpp:275:5: error: 'QRCode' was not declared in this scope
QRCode qrcode;
^
src\main.cpp:276:46: error: 'qrcode_getBufferSize' was not declared in this scope
uint8_t qrcodeData[qrcode_getBufferSize(3)];
^
src\main.cpp:279:22: error: 'qrcode' was not declared in this scope
qrcode_initText(&qrcode, qrcodeData, 3, 0,QR_Char);
^
src\main.cpp:279:30: error: 'qrcodeData' was not declared in this scope
qrcode_initText(&qrcode, qrcodeData, 3, 0,QR_Char);
^
src\main.cpp:279:54: error: 'qrcode_initText' was not declared in this scope
qrcode_initText(&qrcode, qrcodeData, 3, 0,QR_Char);
^
src\main.cpp:294:56: error: 'qrcode_getModule' was not declared in this scope
Serial.print(qrcode_getModule(&qrcode, x, y) ? "\u2588": " ");
^
*** [.pioenvs\esp32dev\src\main.cpp.o] Error 1

P.S:

  • Those Libraries are included and even a duplicate is in the same project libs folder.
  • using Ctrl+LMB i can open the library as usual.

Could you output the log of a compilation run to pastebin.com please. Sure the LDF can’t find something here.

1 Like

Thanks Maxgerhardt,
Here’s the PasteBin Link: > Executing task: C:\Users\NTG\.platformio\penv\Scripts\platformio.exe run < - Pastebin.com

Hm libs seem to be found…


|-- <HttpClient>
|-- <Adafruit SSD1306> 1.2.9
|   |-- <Wire> 1.0.1
|   |-- <SPI> 1.0
|   |-- <Adafruit GFX Library> 1.5.3
|   |   |-- <SPI> 1.0
|-- <ESP8266 QRcode> 2.0.0
|   |-- <ESP8266_SSD1306> 4.0.0
|   |   |-- <Wire> 1.0.1
|   |   |-- <SPI> 1.0

And you are absolutely sure you have a

#include <ESP8266HTTPClient.h>
#include <qrcode.h>

At the start of main.cpp right?

1 Like
Those are the libraries i'm using

#include <Arduino.h>
#include <WiFi.h>
#include <PubSubClient.h>
#include <SPI.h>
#include <aREST.h>
#include <ArduinoJson.h>
#include “AsyncTCP.h”
#include <HttpClient.h>
#include <ESPAsyncWebServer.h>
#include <SPI.h>
#include <qrcode.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
// #include “qrcode.h”

Can you upload a verbose compilation run to pastebin.com?

pio run -t clean
pio run -v
1 Like

Sure,

Hm can you remove the HttpClient lib from the lib/ folder. It should use the built-in from the framework. Maybe you copied the wrong lib, like PlatformIO Registry? Does the example sketch arduino-esp32/BasicHttpClient.ino at master · espressif/arduino-esp32 · GitHub compile?

1 Like

Tried the built in example, it generates the same errors upon compiling.

src\main.cpp: In function ‘void loop()’:
src\main.cpp:72:9: error: ‘HTTPClient’ was not declared in this scope
HTTPClient http;
^
src\main.cpp:77:9: error: ‘http’ was not declared in this scope

Can you uninstall whatever HTTPClient library you have in global storage? Either via the VSCode GUI or via pio lib -g uninstall HttpClient