PlatformIO Community

Esp32 lvgl project build error

after following the steps explained here “Espidf lvgl how to use it” to set up lvgl and lvgl_drivers inside components folder for my project in the project source directory, After setting the tft configuration and touch configuration with menuconfig, I was getting this error


  1. post errors as text not as screenshot
  2. there might be a possibility that LVGL requires a certain ESP-IDF version to be used which is not the one used by PlatformIO (3.3).
  3. Upload the whole project to github or googledrive that you’re having problems with so that the errors are reproducable.

ok i will share a link to the project

this is the googledrive link to the project, ace – Google Drive

Next time please execute the “Clean” project task so that the .pio folder build files are removed – the project can be 28.8MB, not 155MB.

The observed error

In file included from components\lvgl_esp32_drivers\lvgl_helpers.c:10:
components\lvgl_esp32_drivers\lvgl_helpers.c: In function 'lvgl_driver_init':
components\lvgl_esp32_drivers\lvgl_helpers.h:57:25: error: 'LV_HOR_RES_MAX' undeclared (first use in this function); did you mean 'LV_HOR_RES'?
 #define DISP_BUF_SIZE  (LV_HOR_RES_MAX * 40)

which is known at

Or rather, you are using LVGL v8 without the code being compatible with LVGL v8. This is also evident by the components\lvgl\library.json file in your project which says "version": "8.1.0-dev". You cannot use LVGLv8 with the ESP32 port. It looks to me as if you just copied both the latest LVGL and LVGL_esp32 into your project without taking care of version compatibilities between the two.

When I follow the original steps outlined in

aka I build their example project with the exact LVGL versions as they specify ( from 7 months ago, it builds prefectly fine.

RAM:   [=         ]  14.7% (used 48264 bytes from 327680 bytes)
Flash: [====      ]  39.1% (used 410377 bytes from 1048576 bytes)
Building .pio\build\esp32dev\firmware.bin v3.1
Merged 1 ELF section
===================== [SUCCESS] Took 70.91 seconds =====================

see reference project at

I actually followed the steps here on the project i shared, but i started from the " Use LVGL in your ESP-IDF project", I thought since i only want to use the library in a project , I did not go through this step “Build and run the demo.”. I only cloned the lvgl and lvgl_esp32_drivers into the project folder just to have a feel of it before implementing into my project.