No such file error (Arduino.h)

project: espidf-arduino-wifiscan

If I build with LV_TICK_CUSTOM set to 1 in lv_conf.h, the following error occurs in lv_hal_tick.c.
“Arduino.h” is also included in the main.cpp, but no compilation error occurred in it.
If I build with LV_TICK_CUSTOM set to 0, there is no problem. what’s the problem?

Compiling .pio\build\esp-wrover-kit\components\lvgl\src\libs\fsdrv\lv_fs_posix.o
In file included from components\lvgl\src\hal\../lv_conf_internal.h:39,
                 from components\lvgl\src\hal\lv_hal_tick.h:16,
                 from components\lvgl\src\hal\lv_hal_tick.c:9:
components/lv_conf.h:83:36: fatal error: Arduino.h: No such file or directory


#define LV_TICK_CUSTOM 1
    #define LV_TICK_CUSTOM_INCLUDE "Arduino.h"         /*Header for the system time function*/
    #define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis())    /*Expression evaluating to current system time in ms*/
#endif   /*LV_TICK_CUSTOM*/




platform = espressif32
framework = arduino, espidf
monitor_speed = 115200

board = esp-wrover-kit
build_type = debug
lib_deps = bodmer/TFT_eSPI@^2.4.78

The build system may try to be smart here and build components with their isolated build environments, only adding the include path it thinks it needs. When you add build_flags = -I "C:\Users\<user>\.platformio\packages\framework-arduinoespressif32\cores\esp32, it “works”?

1 Like

It works!
I added as follows for “Arduion.h” and “pin_arduino.h”.
How should I deal with this kind of error in the future?

build_flags = 
        -I "C:\Users\JJS\.platformio\packages\framework-arduinoespressif32\cores\esp32"
        -I "C:\Users\JJS\.platformio\packages\framework-arduinoespressif32\variants\esp32"

I’m not sure if the CMakeLists.txt configuration of the LVGL component is bad here so that it cannot include Arduino.h, or whether some PlatformIO build logic is at fault here. Those hacks should definitely not be needed if everything was working nicely.

You can try opnening an issue in GitHub - platformio/platform-espressif32: Espressif 32: development platform for PlatformIO about this.

I was having the same problem and adding the build_flags helped me move on, but I got a new error.

In file included from .pio/libdeps/emulator_64bits/lvgl/src/hal/lv_hal_tick.c:13:
In file included from /Users/eduardo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/Arduino.h:39:
/Users/eduardo/.platformio/packages/framework-arduinoespressif8266/cores/esp8266/esp8266_peri.h:27:10: fatal error: 'c_types.h' file not found
#include "c_types.h"
1 error generated.

what is missing now?


The C types are supposed to be included from the SDK tools/include/c_types.h

I however think that you’re on an extremely wrong path when an enviornment called emulator_64bits wants to include… Espressif 8266 Arduino core stuff? Why would it need that?

I am trying to run an LVGL code created with Squareline
I am trying to run on emulation mode

When I got the fatal error: Arduino.h: No such file

I followed the steps here.

Wouldn’t it make more sense to rid the generated code of the Arduino dependency instead of Frankensteining the Arduino-ESP8266 core to compile on Desktop?

And if you would want to “”“use”“” Arduino on Desktop, at least use something like GitHub - FabioBatSilva/ArduinoFake: Arduino mocking made easy as a base.

This is a combination of trying to learn Ardunio coding and Platformio configuration at the same time.
I am progressing.
Tks a lot for the support.