Pioarduino will not "see" lvgl.h

It’s been an adventure…

I finally deleted everything and re-installed everything from scratch. No other projects show up in explorer (I didn’t want anything to cause any issues, and there have been many…).

I’ve got the one main.cpp file. lvgl in installed, and lvgl.h is included in the main.cpp. lv_conf.h has been modified from the template, with very few changes (first is the “enable this code” at the top of the file)

But when I compile, it throws out many errors related to lvgl. One of them says that “lvgl_conf.h” is probably not included. (but it is) Now the main error is ‘lv_display_t’ does not name a type; did you mean ‘lv_area_t’?

Now, in the main code, the only reference to lvgl besides the lvgl include is *lv_display_t disp; and it’s underlined in red, the co-pilot says it’s undefined. It also indicates that lvgl.h is not included, (but it is). I tried to add lv_obj_t as a test, and same thing, underlined in red, indicating lvgl is not being “seen”.

I’ve seen this issue multiple times (and never fixed) while trying to get this working again.

For whatever reason, pioarduino simply will not “see” lvgl.

devin at pioarduino has no answer or suggestions. I search the internet and not a lot comes up, but I think I saw something about a bug that causes this. I can’t find much at the moment, I’ve been working for days on this, deleting, installing, uninstalling, re-installing… now I’ve got a clean install, and it still shows up.

I thought it was related to the board def file but I’ve tried a couple different ones and no change. Moving/copying lv_conf.h and lvgl.h to the includes directory doesn’t help either.

Some time yesterday, I could use platformio co-pilot and add all the headers it suggested, but it’s the same headers that are included in the lvgl.h file.

So, I can include the same headers and the code (might) compile (no red underlines anyway). For some reason, lvgl.h just will not get used. There doesn’t seem to be a problem with any other of the libraries, just lvgl.

Any suggestions?

Here’'s the platformio.ini file: (The “-D RV” flag is used to chose which Shelly energy monitor I talk to, the one at home or the one in the RV. And the lvgl library IS in the paths.

[env:esp32-s3-devkitc-1-myboard]
platform = espressif32 @ 6.12.0
board = esp32-s3-devkitm-1
framework = arduino
monitor_speed = 115200
board_build.partitions = huge_app.csv
board_build.f_cpu = 240000000L
build_flags =
-D LV_CONF_INCLUDE_SIMPLE
-D RV
-I include
-mfix-esp32-psram-cache-issue
lib_deps =
lvgl/lvgl@^9.5.0
lovyan03/LovyanGFX@^1.2.20
tamctec/TAMC_GT911@^1.0.2
adafruit/Adafruit GFX Library@^1.12.6
maxpromer/PCA9557-arduino@^1.0.0
bblanchon/ArduinoJson@^7.2.2

It’s dirty, but if I copy the contents of the lvgl.h file, into an new file (my_lvgl.h) and put it in the include directory, and include that in my headers, it (seems to) works.

(but now I get a million errors about lvgl and lovyan color definitions colliding…) but that’s a different issue.

Actually I think that’s part of the same problem. The definitions are the same, so I think the compiler should be choosing one file over the other, but because “something” in the lvgl library isn’t also being seen, it doesn’t know so it’s seeing those two files as separate includes, and trying to use them both when it should know to use one over the other.

Sorry, I’m not able to solve your problem but I want to give you some adivces.

The platformio.ini is very sensitive to indentation. Maybe it’s just a display thing and your indentation is correct. Please post your platformio.ini as pre-formatted text. This will keep the indentation correct and such errors can be excluded by reviewers of your platformio.ini.

Remove the build flag -mfix-esp32-psram-cache-issue! This is only necessary for ESP32 (not the S3!) when PSRAM is used. Your configuration doesn’t even use PSRAM.

Also remove the build-flag -I include. The include directory is automatically included when searching for header files. There is no need to specify this explicitly - See build_flags — PlatformIO latest documentation

Keep things as simple as possible. Create a small, minimal project that allows you to reproduce the error and focus exclusively on it. Also, reduce the platformio.ini file to the bare essentials.

Thanks for looking at it anyway.

I removed the reference to PSRAM.
The include flag was added only as a way to try and force it to see the lvgl.h.

This is the whole ini file.

This was a working project, so it’s not like I just threw a bunch of stuff together and expected it to work. I only removed almost all the code except for a few lovyan and lvgl statements. Maybe, just maybe, if I can find where the statement that chooses those libraries to use, I can add that to my include (like I did with lvgl.h → my_lvgl.h), but I could end up with more errors.

I’ll probably revert back to the older platformio and arduino libraries for this project. When I got here, all I had to do was change the address of the Shelly Energy Meter. Everything was working on a different meter (it’s only an http.GET(); change, no code). I’ve spent a week messing with it, with no luck, so probably revert.

; 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:esp32-s3-devkitc-1-myboard]
platform = espressif32 @ 6.12.0
board = esp32-s3-devkitm-1
framework = arduino
monitor_speed = 115200
board_build.partitions = huge_app.csv
board_build.f_cpu = 240000000L
build_flags = 
	-D LV_CONF_INCLUDE_SIMPLE
	-D RV
	-Isrc/
lib_deps = 
	lvgl/lvgl@^9.5.0
	lovyan03/LovyanGFX@^1.2.20
	tamctec/TAMC_GT911@^1.0.2
	adafruit/Adafruit GFX Library@^1.12.6
	maxpromer/PCA9557-arduino@^1.0.0
	bblanchon/ArduinoJson@^7.2.2

I think the root cause of my issues here is that I installed Platformio in a “non-standard” location.

It acts like the location is hard coded to “install_root”\Users"user_ID".platformio".

Platformio would throw various errors about not finding something, even though I could find it and see it myself. But it was looking in a different location. I was looking for them where I installed them and expected them. Platformio, was looking for them where IT expected them to be.

I’m sure there must be a rather simple fix, but I couldn’t find it. I tried a couple of things, but nothing worked. So I just deleted everything and reinstalled it in the preferred location, and so far, things are running smoother.

And yes, I did have an environment variable that pointed to the installed location. But it didn’t work for everything.

Now, on on startup, I get an error that it can’t find the compiler, because it’s still looking in the old location. But it switches to the current location.

(another problem I’m sure, but not platformio, is when you uninstall everything, stupid Windows, remembers almost everything, so it’s re-loading everything. I’d remove everything, re-install VSCode, and next thing you know, there’s platformio with all your projects and settings… one of these days… I’m gonna switch. I’ve disliked Windows from ver. 3.11, and hated it sometime after that.)

Which location did you use and how did you do this? Additionally: Why did you change the default path?

Which exact steps did you do to “reinstall” PlatformIO?

Which one exactly?
Did you set the correct one? Please check Environment Variables — PlatformIO latest documentation

Again: What exactly did you remove

This is not necessary.

I installed it in the root, because it would be easier for me to access files.

For the previous install, I had the environment variable PLATFORMIO_CORE_DIR set and pointing to the location in the root, so, c:\platformio. it’s since been removed.

When I removed it, I used the platformio extension in VScode to “uninstall” platformio. After it kept coming back, I did that again, and used windows program uninstall to remove VScode. Then deleted everything I could find related to platformio or VScode. Then did a new install of everything. Even after that, platformio kept showing up, very persistent.

I even created two new empty projects to start clean. Other than the Lovyan/LVGL issue, it seems to be working again. The Lovyan/LVGL issue, seems to be caused by having Adafruit installed. Remove that, and the error goes away (at least for now)

I agree, deleting everything should not be necessary, but sometimes it’s better to just start over instead of fighting it. Even after deleting everything, like I said, it still came back before I could tell VScode to install it.

I didn’t keep the errors, so I don’t know if it was the compiler or the linker (or something else) that was throwing the errors. That’s one reason it was hard to notice, except for the "\users" being in the path. The path in the error report looked correct at first glance.