Uild fails with "file not found" error on a fresh installation

Hello,

I am trying to compile the Filatrack ESP32 project, but the build keeps failing with “file not found” errors for lvgl/lvgl.h and TFT_WIDTH, even though my configuration files seem to be correct.

I have already tried the following troubleshooting steps without success:

  • Confirmed all project files are complete, including the src/lvgl_ui directory.
  • Moved the project to a local folder (C:\...) outside of OneDrive.
  • Created and configured src/lv_conf.h.
  • Configured my display settings in lib/TFT_eSPI/User_Setup.h.
  • Completely uninstalled and reinstalled VS Code and PlatformIO, and deleted the .platformio and .vscode folders.

Even after all these steps on a fresh installation, the build still fails.

Here is my platformio.ini file:

; PlatformIO Project Configuration File

[env:esp3dev]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
    lvgl/lvgl@^8.3.11        ; Lock to LVGL v8 for compatibility
    TFT_eSPI                 ; Display driver
    XPT2046_Touchscreen      ; Touch controller
    Arduino_MFRC522v2        ; RFID reader
    HX711                    ; Weight sensor
    PubSubClient             ; MQTT client
    ArduinoJson              ; JSON handling
build_flags =
    -I src
    -I src/lvgl_ui
    -D LV_CONF_INCLUDE_SIMPLE
    -D USER_SETUP_LOADED
    -D DEBUG
monitor_speed = 115200        ; Serial monitor baud rate

Here is the full error log from the terminal when I try to build:

Processing esp3dev (platform: espressif32; board: esp32dev; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.12.0) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 3.20017.241212+sha.dcc1105b
 - tool-esptoolpy @ 2.40900.0 (4.9.0)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 41 compatible libraries
Scanning dependencies...
Dependency Graph
|-- lvgl @ 8.4.0
|-- TFT_eSPI @ 2.5.43
|-- XPT2046_Touchscreen
|-- Arduino_MFRC522v2 @ 2.0.1
|-- HX711 @ 0.7.5
|-- PubSubClient @ 2.8.0
|-- ArduinoJson @ 7.3.1
|-- WiFi @ 2.0.0
|-- ArduinoOTA @ 2.0.0
|-- SPI @ 2.0.0
|-- SPIFFS @ 2.0.0
Building in release mode
Compiling .pio\build\esp3dev\src\components\DisplayComponent.cpp.o
Compiling .pio\build\esp3dev\src\lvgl_port.cpp.o
Compiling .pio\build\esp3dev\src\lvgl_ui\images.c.o
Compiling .pio\build\esp3dev\src\lvgl_ui\screens.c.o
Compiling .pio\build\esp3dev\src\lvgl_ui\styles.c.o
Compiling .pio\build\esp3dev\src\lvgl_ui\ui.c.o
Compiling .pio\build\esp3dev\src\lvgl_ui\ui_image_einstellungen.c.o
In file included from src/lvgl_ui/styles.c:1:
src/lvgl_ui/styles.h:4:10: fatal error: lvgl/lvgl.h: No such file or directory
 #include <lvgl/lvgl.h>
          ^~~~~~~~~~~~~
compilation terminated.
In file included from src/lvgl_ui/ui.c:5:
src/lvgl_ui/ui.h:4:10: fatal error: lvgl/lvgl.h: No such file or directory
 #include <lvgl/lvgl.h>
          ^~~~~~~~~~~~~
compilation terminated.
Compiling .pio\build\esp3dev\src\lvgl_ui\ui_image_logo.c.o
*** [.pio\build\esp3dev\src\lvgl_ui\styles.c.o] Error 1
*** [.pio\build\esp3dev\src\lvgl_ui\ui.c.o] Error 1
In file included from src/lvgl_ui/screens.c:3:
src/lvgl_ui/screens.h:4:10: fatal error: lvgl/lvgl.h: No such file or directory
 #include <lvgl/lvgl.h>
          ^~~~~~~~~~~~~
compilation terminated.
*** [.pio\build\esp3dev\src\lvgl_ui\screens.c.o] Error 1
In file included from include/components/DisplayComponent.hpp:5,
                 from src/components/DisplayComponent.cpp:1:
lib/TFT_eSPI/TFT_eSPI.h:973:8: warning: #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available! [-Wcpp]
       #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available!
        ^~~~~~~
In file included from include/components/DisplayComponent.hpp:8,
                 from src/components/DisplayComponent.cpp:1:
include/config.h:22: warning: "TFT_MISO" redefined
 #define TFT_MISO    19

In file included from lib/TFT_eSPI/TFT_eSPI.h:101,
                 from include/components/DisplayComponent.hpp:5,
                 from src/components/DisplayComponent.cpp:1:
lib/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:306: note: this is the location of the previous definition
       #define TFT_MISO -1

In file included from include/components/DisplayComponent.hpp:8,
                 from src/components/DisplayComponent.cpp:1:
include/config.h:24: warning: "TFT_CS" redefined
 #define TFT_CS       5    // Chip Select

In file included from lib/TFT_eSPI/TFT_eSPI.h:101,
                 from include/components/DisplayComponent.hpp:5,
                 from src/components/DisplayComponent.cpp:1:
lib/TFT_eSPI/Processors/TFT_eSPI_ESP32.h:203: note: this is the location of the previous definition
   #define TFT_CS -1  // Keep DMA code happy

In file included from include/components/DisplayComponent.hpp:8,
                 from src/components/DisplayComponent.cpp:1:
include/config.h:43: warning: "SPI_TOUCH_FREQUENCY" redefined
 #define SPI_TOUCH_FREQUENCY 4000000

In file included from include/components/DisplayComponent.hpp:5,
                 from src/components/DisplayComponent.cpp:1:
lib/TFT_eSPI/TFT_eSPI.h:141: note: this is the location of the previous definition
   #define SPI_TOUCH_FREQUENCY  2500000

In file included from src/lvgl_port.cpp:2:
lib/TFT_eSPI/TFT_eSPI.h:973:8: warning: #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available! [-Wcpp]
       #warning >>>>------>> TOUCH_CS pin not defined, TFT_eSPI touch functions will not be available!
        ^~~~~~~
lib/TFT_eSPI/TFT_eSPI.h:432:25: error: 'TFT_WIDTH' was not declared in this scope
   TFT_eSPI(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
                         ^~~~~~~~~
In file included from src/lvgl_port.cpp:2:
lib/TFT_eSPI/TFT_eSPI.h:432:25: error: 'TFT_WIDTH' was not declared in this scope
   TFT_eSPI(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
                         ^~~~~~~~~
lib/TFT_eSPI/TFT_eSPI.h:432:25: note: suggested alternative: 'TFT_WHITE'
   TFT_eSPI(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
                         ^~~~~~~~~
                         TFT_WHITE
lib/TFT_eSPI/TFT_eSPI.h:432:49: error: 'TFT_HEIGHT' was not declared in this scope
   TFT_eSPI(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
                                                 ^~~~~~~~~~
lib/TFT_eSPI/TFT_eSPI.h:432:25: note: suggested alternative: 'TFT_WHITE'
   TFT_eSPI(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
                         ^~~~~~~~~
                         TFT_WHITE
lib/TFT_eSPI/TFT_eSPI.h:432:49: error: 'TFT_HEIGHT' was not declared in this scope
   TFT_eSPI(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
                                                 ^~~~~~~~~~
lib/TFT_eSPI/TFT_eSPI.h:432:49: note: suggested alternative: 'TFT_OLIVE'
   TFT_eSPI(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
                                                 ^~~~~~~~~~
                                                 TFT_OLIVE
lib/TFT_eSPI/TFT_eSPI.h:432:49: note: suggested alternative: 'TFT_OLIVE'
   TFT_eSPI(int16_t _W = TFT_WIDTH, int16_t _H = TFT_HEIGHT);
                                                 ^~~~~~~~~~
                                                 TFT_OLIVE
src/lvgl_port.cpp: In function 'void lvgl_port_init()':
src/lvgl_port.cpp:43:25: error: 'TFT_WIDTH' was not declared in this scope
     size_t buf_pixels = TFT_WIDTH * 40; // 40 lines buffer
                         ^~~~~~~~~
src/lvgl_port.cpp:43:25: note: suggested alternative: 'TFT_WHITE'
     size_t buf_pixels = TFT_WIDTH * 40; // 40 lines buffer
                         ^~~~~~~~~
                         TFT_WHITE
src/lvgl_port.cpp:51:24: error: 'TFT_HEIGHT' was not declared in this scope
     disp_drv.ver_res = TFT_HEIGHT;
                        ^~~~~~~~~~
src/lvgl_port.cpp:51:24: note: suggested alternative: 'TFT_OLIVE'
     disp_drv.ver_res = TFT_HEIGHT;
                        ^~~~~~~~~~
                        TFT_OLIVE
*** [.pio\build\esp3dev\src\lvgl_port.cpp.o] Error 1
*** [.pio\build\esp3dev\src\components\DisplayComponent.cpp.o] Error 1
================================================ [FAILED] Took 17.24 seconds ================================================

 *  The terminal process "C:\Users\daksh\.platformio\penv\Scripts\platformio.exe 'run'" terminated with exit code: 1. 
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: C:\Users\daksh\.platformio\penv\Scripts\platformio.exe run

Could there be an issue with my computer’s environment that is causing this? Any help would be appreciated.

Thank you.

Can you link to that project? I didn’t find it.

I am new to this platform. can you explain who to send the files

No I mean, that sounded like you found that project online at like Github?

This project was send by my client .he told the he make it and some of his friends make it . it has some error and i rectified it and then finally i got this error .

I see.

This looks weird. Usually it’s just

This is not enough to fully configure the TFT_eSPI library. Some of the settings for that seem to have been moved into include/config.h based on the errors like

Configuration files need to #undef the previous settings as needed, so,

#undef SPI_TOUCH_FREQUENCY
#define SPI_TOUCH_FREQUENCY 4000000
//..

can i get more information.

Configuration of the TFT_eSPI library in a PlatformIO project is done via the platformio.ini. Please see TFT_eSPI/docs/PlatformIO/Configuring options.txt at master · Bodmer/TFT_eSPI · GitHub

Sorry bro it not work’s. there is some other solutions.