Newbie IntelliSence and Include Issues (VSCode, PIO, Espidf, TFT_eSPI)


I am a beginner when it comes to PIO. I have an ESP32 and I am trying to use PIO and Espidf with the TFT_eSPI graphics library on Windows 10. I have attempted new projects with different settings, but the issue seems to be with the PIO and VSCode.

The main error I get is:
Cannot find “C:\Users\Username.platformio\packages\framework-espidf\components\esp_hw_support\port\esp32\private_include”.

I think this is due to the auto-generated JSON file that VSCode forces me to make because IntelliSense not working properly with PIO.

So when I go to include my graphics library, it will give me an error saying that it cannon find the library I am trying to include and that it can’t find the folder called “private_include”.

I am able to run basic code with the freeRTOS.h but when I try to include new libraries I get the:
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit
cannot open source file “TFT_eSPI.h”

I have tried to change versions of the platform and graphics library, but in the end, the error comes when I make that JSON file.

I have also tried uninstalling and reinstalling VSCode and PIO.

When I try to fix the include error, VSCode gives me the option to fix this by changing the settings for the Windows C/C++ Extension, but Im not sure how or what to change here.

Has anyone experienced this issue and knows how to fix it?

Intellisense erros are initially there but you need to trigger a build once for it to refresh properly.

What the platformio.ini and the error you’re getting when building?

Alright, I built the project and it seems to be the same error.

My platformio.ini is:

platform = espressif32
board = esp32dev
framework = espidf
lib_deps = bodmer/TFT_eSPI@^2.5.30

The error I get is:

rc/main.c:5:10: fatal error: TFT_eSPI.h: No such file or directory

* Looking for TFT_eSPI.h dependency? Check our library registry!
* CLI  > platformio lib search "header:TFT_eSPI.h"
* Web  >

    5 | #include <TFT_eSPI.h> // Hardware-specific library
      |          ^~~~~~~~~~~~
compilation terminated.
Compiling .pio\build\esp32dev\app_trace\gcov\gcov_rtio.o
Compiling .pio\build\esp32dev\app_trace\port\port_uart.o
Compiling .pio\build\esp32dev\app_update\esp_ota_ops.o
*** [.pio\build\esp32dev\src\main.o] Error 1

No. You need to add TFT_eSPI as a ESP-IDF component when you’re working with ESP-IDF, don’t use lib_deps. See example project and documentation. Don’t forget to run the menuconfig as documented and select your display settings.