Avr/pgmspace.h No Such File Or Directory" Error For ESP8266
Maybe your like
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. system July 25, 2018, 10:20am 2One 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.
Juraj July 25, 2018, 11:16am 3the 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.
OpampInverting July 25, 2018, 11:48am 4I 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!!
pert July 25, 2018, 2:44pm 5Juraj: 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 LikeRelated topics
| 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 |
Tag » Arduino Avr/pgmspace.h No Such File Or Directory
-
"avr/pgmspace.h: No Such File Or Directory" On ESP8266. Patch Inside.
-
ESP32 Doesn't Compile · Issue #241 - GitHub
-
Esp32 - I2C_graphical_LCD_display, Fatal Error: Avr/pgmspace.h
-
Avr/pgmspace.h: No Such File Or Directory - YouTube
-
Fatal Error: Pgmspace.h: No Such File Or Directory | M5Stack Community
-
Pgmspace.h: No Such File Or Directory - The Things Network
-
Fatal Error: Avr/pgmspace.h: No Such File Or Directory - SourceForge
-
This Arduino Library Doesn't Work On ESP. How Do I Make It Working?
-
In Included File 'avr/pgmspace.h' File Not Found - PlatformIO Community
-
Fatal Error: Avr\pgmspace.h: No Such File Or Directory - Visual Micro
-
MicroOLED No Longer Works. - SparkFun Forums
-
I2C_graphical_LCD_display, Fatal Error: Avr/pgmspace.h - SolveForum
-
Esp8266/Arduino - Gitter
-
ขึ้น Fatal Error : Avr/pgmspace.h : No Such File Or Directory แก้ยังไงครับ