The authors of the ESP32 core didn't bother to create a proper set of compatability shims for the PROGMEM system - chiefly because it's not needed for ESP32 operation.

We did for chipKIT, though, and you can grab a copy of ours here and place it in with the core files for the ESP32 in your Arduino installation (you only need the pgmspace.h file, and place it in an avr folder inside the core source folder).

It's completely architecture agnostic and basically defines some pretty much empty macros, and maps _P variants of various functions to the non _P alternatives.

Answer from Majenko on Stack Exchange
🌐
GitHub
github.com › arduino › Arduino › issues › 11736
ESP32 boards: `#include <avr/pgmspace.h>` results in `fatal error: avr/pgmspace.h: No such file or directory -> candidates: []` · Issue #11736 · arduino/Arduino
January 8, 2022 - The toolchain for all other processors and architectures (avr, arm, Intel and even esp8266) provide this file under path .../packages/.../avr/pgmspace.h, but esp32 toolchain provides it under path .../packages/esp32/hardware/esp32/1.0.6/cores/esp32/pgmspace.h which prevents compiling otherwise compatible sketches and libraries.
Author   dmalenic
🌐
EEVblog
eevblog.com › forum › beginners › why-is-this-error-in-this-arduino-program-397458
why is this error in this arduino program? - avr/pgmspace.h
October 18, 2023 - EEVblog Captcha · We have seen a lot of robot like traffic coming from your IP range, please confirm you're not a robot · This security check has been powered by · CrowdSec
Discussions

<avr/pgmspace.h> no such file or directory running particle could on Raspberry pi3
Hi, i'm trying to flash an arduino program to my raspberry pi3 through Particle cloud ide. The cloud has my pi device recognized. But when i tried to flash the program to the pi. I got an error saying: "Print.h" no such… More on community.particle.io
🌐 community.particle.io
0
0
May 1, 2017
"Fatal Error: avr/pgmspace.h no such file or directory" error for ESP8266
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. More on forum.arduino.cc
🌐 forum.arduino.cc
0
0
July 25, 2018
visual studio code - How to make Arduino work and not give "cannot open source file "avr/pgmspace.h"" on vscode? - Stack Overflow
I'm trying to program arduino in vscode. The problem is that It's giving me weird header errors: cannot open source file "avr/pgmspace.h" (dependency of "C:\Program Files (x86)\Arduino\hardware\ard... More on stackoverflow.com
🌐 stackoverflow.com
Using LedControl.h library: avr/pgmspace.h: No such file or directory
Hi, I am trying to use the Arduino LedControl library to drive a max7219 led matrix display but when I compile, there is no avr/pgmspace.h Many led control libraries use pgmspace.h. Is this availab... More on github.com
🌐 github.com
3
July 13, 2017
🌐
Particle
community.particle.io › firmware › libraries
<avr/pgmspace.h> no such file or directory running particle could on Raspberry pi3 - Libraries - Particle
May 1, 2017 - Hi, i'm trying to flash an arduino program to my raspberry pi3 through Particle cloud ide. The cloud has my pi device recognized. But when i tried to flash the program to the pi. I got an error saying: "Print.h" no such…
🌐
Arduino Forum
forum.arduino.cc › projects › programming
"Fatal Error: avr/pgmspace.h no such file or directory" error for ESP8266 - Programming - Arduino Forum
July 25, 2018 - 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.
Top answer
1 of 4
8

Based on the responses to this issue, I added "c:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\avr\\**" to my include path in c_cpp_properties.json:

"includePath": [
    "c:\\Program Files (x86)\\Arduino\\tools\\**",
    "c:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\**",
    "c:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr\\avr\\**"
],
2 of 4
6

For anyone who stumbles here on a Mac, here is the config that works for me with the Uno:

{
    "env": {
        "arduino_path": "/Applications/Arduino.app/Contents/Java",
        "arduino_avr_include_path": "${env:arduino_path}/hardware/arduino/avr",
        "arduino_avr_include2_path": "${env:arduino_path}/hardware/tools/avr/avr/include",
        "arduino_avr_compiler_path": "${env:arduino_path}/hardware/tools/avr/bin/avr-g++"
    },
    "configurations": [
        {
            "name": "Mac",
            "defines": [
                "ARDUINO=10810",
                "__AVR_ATmega328P__",
                "UBRRH"
            ],
            "includePath": [
                "${workspaceRoot}",
                "${env:arduino_avr_include_path}/**",
                "${env:arduino_avr_include2_path}/**"
            ],
            "forcedInclude": [
                "/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h"
            ],
            "intelliSenseMode": "gcc-x64",
            "cStandard": "c11",
            "cppStandard": "c++11",
            "compilerPath": "${env:arduino_compiler_path} -std=gnu++11 -mmcu=atmega328p"
        }
    ],
    "version": 4
}

The key to finding <avr/pgmspace.h> was the adding the hardware/tools/avr/avr/include path.

Defining ARDUINO=10810 was identified from the output of running Arduino: Verify with the verbose flag.

Defining __AVR_ATmega328P__ was added to allow proper IntelliSense completion of the raw register macros (e.g. _BV(), OCR0A, TIMSK0, etc.); the correct macro to define was identified based on the chip being an ATMEGA328P-PU and by inspection of the file hardware/tools/avr/avr/include/avr/io.h.

🌐
GitHub
github.com › espressif › arduino-esp32 › issues › 508
Using LedControl.h library: avr/pgmspace.h: No such file or directory · Issue #508 · espressif/arduino-esp32
July 13, 2017 - Hi, I am trying to use the Arduino LedControl library to drive a max7219 led matrix display but when I compile, there is no avr/pgmspace.h Many led control libraries use pgmspace.h. Is this available or possible on esp32? I am using an A...
Author   grplyler
🌐
GitHub
github.com › SodaqMoja › Sodaq_DS3231 › issues › 5
"avr/pgmspace.h: No such file or directory" on ESP8266. Patch inside. · Issue #5 · SodaqMoja/Sodaq_DS3231
April 6, 2016 - Hi! I am using this library together with my NodeMCU and other ESP8266-12 modules. But the library/compiler throws the following error: "fatal error: avr/pgmspace.h: No such file or directory". I found the following solution: In Sodaq_DS...
Author   ikarisan
Find elsewhere
🌐
Arduino Forum
forum.arduino.cc › projects › programming
Fatal error: pgmspace.h: No such file or directory Help! - Programming - Arduino Forum
October 31, 2022 - There are several lines of code ... #if (defined(__AVR__)) #include #else #include #endif If I use the board Arduino Uno WiFi Rev2 then, everything is fine. However, if I use the arduino board MKR wifi 1010 then it shows that fatal error: pgmspace.h: No such file or directory ...
🌐
The Things Network
thethingsnetwork.org › end devices (nodes)
Pgmspace.h: No such file or directory - End Devices (Nodes) - The Things Network
October 5, 2018 - Hi, i am trying the Arduino sketch DeviceInfo for LoRaExplorer. The comilation fails: TheThingsNetwork.h:12:22: fatal error: pgmspace.h: No such file or directory I follow all the instruction to install TheThingsNEtwo…
🌐
PlatformIO Community
community.platformio.org › t › in-included-file-avr-pgmspace-h-file-not-found › 21635
In included file 'avr/pgmspace.h' file not found - PlatformIO Community
May 26, 2021 - Hello there! I’m on Linux, using vim and I use clangd as my language server. The code compiles fine but it always gives me something missing, e.g. Use of undeclared identifyer ‘Serial’ and In included file ‘avr/pgmspace…
🌐
Maker Forums
forum.makerforums.info › archive › fastled archive
Ever get the dreaded error: fatal error: avr/pgmspace.h: - FastLED Archive - Maker Forums
January 26, 2018 - Ever get the dreaded error: fatal error: avr/pgmspace.h: No such file or directory Well then replace #if FASTLED_INCLUDE_PGMSPACE == 1 #include <avr/pgmspace.h> #endif with #if (defined(AVR)) #include <avr\pgmspa…
🌐
Answer Overflow
answeroverflow.com › m › 1409988454753894520
Arduino nano esp32 error code avr/ pgmspace no such file ...
August 26, 2025 - Hi I'm trying to upload a sketch code from Arduino ide to my Arduino nano esp32 but I get the error code
🌐
VisualMicro
visualmicro.com › forums › YaBB.pl
VS Arduino - fatal error: avr\pgmspace.h: No such file or directory
Help and assistance with Microsoft Visual Studio, cross-platform Arduino compatible development with GDB, WiFi and Serial Debugging. 100's of extensions such as team code sharing, unit testing. Multi-platform and multi-architecture build system. Firmware Disassembly Viewer, Memory Inspection, ...
🌐
GitHub
github.com › TheThingsNetwork › arduino-device-lib › issues › 241
ESP32 doesn't compile · Issue #241 · TheThingsNetwork/arduino-device-lib
August 9, 2018 - I wanted to compile the Code for an Heltec-ESP32-Module and got the error: /Arduino/libraries/TheThingsNetwork/src/TheThingsNetwork.h:9:26: fatal error: avr/pgmspace.h: No such file or directory
Author   jstrobel
🌐
Arduino Forum
forum.arduino.cc › projects › programming
Library pgmspace - Programming - Arduino Forum
January 15, 2023 - Hi everyone, I have a problem; I have an error which tells me this: and I couldn't find this library, it's my first time receiving this type or error. c:\Users\alexi\OneDrive\Documents\Arduino\libraries\Adafruit_SSD1306\Adafruit_SSD1306.cpp:42:10: fatal error: pgmspace.h: No such file or directory #include ^~~~~~~~~~~~ compilation terminated. exit status 1 Compilation error: exit status 1
🌐
Arduino Forum
forum.arduino.cc › projects › programming
arduino v1.0 compile error: avr\pgmspace.h: No such file or directory - Programming - Arduino Forum
January 10, 2012 - I am new to Arduino. I've installed the Arduino IDE 1.0 on a MacOSX platform and have been checking out Mikal Hart's TinyGPS package. http://arduiniana.org/libraries/tinygps/ http://arduiniana.org/TinyGPS/TinyGPS10.zip However I'm encountering a compile error with one of the example sketches ...
🌐
GitHub
github.com › esp8266 › Arduino › issues › 2366
#include <avr/pgmspace.h> · Issue #2366 · esp8266/Arduino
August 4, 2016 - I am trying to use nokia 5110 screen with my ESP and when I compile my code i receive this: C:\Users\g\Documents\Arduino\libraries\Adafruit-PCD8544-Nokia-5110-LCD-library-master\Adafruit_PCD8544.cpp:20:26: fatal error: avr/pgmspace.h: No...
Author   gbougakov