Fatal error: avr/eeprom.h

Hi

I am doing my first program.

I installed the EEPROMEx library and in the platformio.ini file it has the following:

[env: esp32doit-devkit-v1]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino

lib_deps =
   # Using a library name
   EEPROMEx
 
   # ... or using library Id
   170

   # ... or depend on a specific version
   EEPROMEx @ 09d7586108

When compiling it says:

In file included from C: \ Users \ fgarz \ .platform \ lib \ EEPROMEx_ID170 \ EEPROMex.cpp: 23: 0:
C: \ Users \ fgarz \ .platformio \ lib \ EEPROMEx_ID170 \ EEPROMex.h: 29: 24: fatal error: avr / eeprom.h: No such file or directory
compilation terminated.
*** [.pio \ build \ esp32doit-devkit-v1 \ lib377 \ EEPROMEx_ID170 \ EEPROMex.cpp.o] Error 1

Where can I get the eeprom.h file and where should I install it?

Thank you

The library is not meant for ESP32 devices, since it requires avr/eeprom.h, in particular the eeprom_read_byte, eeprom_read_word, eeprom_read_dword and eeprom_is_ready functions. The Arduino-ESP32 framework does not emulate this avr/eeprom.h header, so it doesn’t exist and this library cannot be used, but it gives you its own Arduino-compatible EEPROM class / library as EEPROM.h, which is specially implemented to use the ESP32’s flash as “EEPROM” emulation. See arduino-esp32/EEPROM.h at master · espressif/arduino-esp32 · GitHub.

1 Like