Arduino IDE can't find bundles ESP32 libraries

Hi folks,

I’m having trouble compiling a project that used to work just fine, I have no idea what happened all of a sudden.

The details:

  • Building for a Lolin D32 Pro which is a ESP32 board
  • Installed ESP32 boards using the external installation URL, and installed boards from the board manager.
  • Arduino IDE version: 1.8.12
  • ESP32 package version 1.0.4
  • Windows 10

The issue I’m having is that the IDE can no longer find the bundled libraries that come with the ESP32 hardware package, particularly the Preferences.h library that is used to manage EEPROm

Looking through the files inside the AppData I can see that all the libraries are clearly present, and when I use an explicit path to the header file it works just fine, but the IDE was able to find these libraries until it wasn’t.

I tried:

  • completely removing and reinstalling the IDE
  • removing and reinstalling the board definitions
    *restarting my computer at every step

The code is very basic, the error comes up on:

#include <Preferences.h>

with:

In file included from ...project.ino:39:0:

Settings.h:8:25: fatal error: Preferences.h: No such file or directory

compilation terminated.

exit status 1
Preferences.h: No such file or directory

I don’t reallyy know where to keep poking to sort this out, I’d appreciate any help.

Update:
This problem seems to go away when the libraries are included in the main .ino file rather than in any of the .h files in the project folder.

So if I move <Preferences.h> to the main sketch .ino file the error goes away, but that makes for non-portable code and doesn’t really solve the problem.