Avr/pgmspace.h No Such File Or Directory" Error For ESP8266

"Fatal Error: avr/pgmspace.h no such file or directory" error for ESP8266 Projects Programming July 25, 2018, 10:16am 1

Hi!

I am using Arduino IDE to program my NodeMCU module. I am trying to interface seven segment display using MAX7219 IC. FOr that I am using LedControl library from here. I have seen people using LedControl library with their ESP8266 but my IDE is refusing to compile it. One of the tutorials even said "Since the LedControl library does not utilize any hardware specific functions of Arduino platform, it is compatible with ESP8266"

My IDE throws the following error:

Arduino: 1.8.6 Hourly Build 2018/01/03 03:33 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200" In file included from G:\arduino-nightly\project\sketch_jul23a\sketch_jul23a.ino\sketch_jul23a.ino.ino:1:0: C:\Users\HP\Documents\Arduino\libraries\LedControl\src/LedControl.h:30:26: fatal error: avr/pgmspace.h: No such file or directory #include <avr/pgmspace.h>                           ^ compilation terminated. exit status 1 Error compiling for board NodeMCU 1.0 (ESP-12E Module). This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences. July 25, 2018, 10:20am 2

One of the tutorials even said "Since the LedControl library does not utilize any hardware specific functions of Arduino platform, it is compatible with ESP8266"

Well, you know that EVERYTHING you read on the internet is the absolute truth, and nothing but the truth, you must be doing something wrong to get that compiler error.

Of course, there are two possibilities. One is that the author of that statement was using a different version of the library than you are using. The other is that the author was full of sh*t.

July 25, 2018, 11:16am 3

the esp8266 core really contains that file in the 2.4.1 git version

Arduino/cores/esp8266/avr at master · esp8266/Arduino

master/cores/esp8266/avr

ESP8266 core for Arduino. Contribute to esp8266/Arduino development by creating an account on GitHub.

July 25, 2018, 11:48am 4

I found the answer. You can remove #include <avr/pgmspace> from the LedControl.h header file or just create the dir where it is looking for the file. I took the easy route.

GOOD LUCK!!

July 25, 2018, 2:44pm 5

Juraj: the esp8266 core really contains that file in the 2.4.1 version Arduino/cores/esp8266/avr at master · esp8266/Arduino · GitHub

That change was actually made after the 2.4.1 release so the current code will not work with ESP8266 core 2.4.1. With 2.4.1 or earlier you would do something like this:

#if defined(AVR) #include <avr/pgmspace.h> #else //defined(AVR) #include <pgmspace.h> #endif //defined(AVR)

but it's interesting to see they did that. It's how Arduino SAMD Boards and Arduino SAM boards works too so it probably makes sense.

1 Like
Topic Replies Views Activity
Programming ESP8266 (NODEMCU) with arduino IDE Programming 2 3217 May 5, 2021
fatal error: avr\pgmspace.h: No such file or directory Software 28 11206 May 7, 2021
#include <pgmspace.h> macht Probleme Deutsch 6 7772 May 6, 2021
Sys/pgmspace.h no such file Programming 5 2532 November 20, 2022
Adafruit_SH1106.cpp and ESP32 3rd Party Boards 2 80 October 27, 2025
Unfortunately, your browser is unsupported. Please switch to a supported browser to view rich content, log in and reply.

Tag » Arduino Avr/pgmspace.h No Such File Or Directory