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 - #include compiles on all supported processors and architectures except ESP32. It is probably related to location of this file within the esp32 toolchain. The toolchain for all other processors and architectures (avr, arm...
Author   dmalenic
🌐
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.
Discussions

why is this error in this arduino program? - avr/pgmspace.h
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 More on eevblog.com
🌐 eevblog.com
October 18, 2023
<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 file or directory. So i googled to copy the Print.h and Print.cpp ... More on community.particle.io
🌐 community.particle.io
0
0
May 1, 2017
"avr/pgmspace.h: No such file or directory" on ESP8266. Patch inside.
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 f... More on github.com
🌐 github.com
11
April 6, 2016
Fatal error: pgmspace.h: No such file or directory Help!
There are several lines of code inside Base64 library: #include "Base64.h" #include #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: ... More on forum.arduino.cc
🌐 forum.arduino.cc
0
0
October 31, 2022
🌐
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
🌐
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 file or directory. So i googled to copy the Print.h and Print.cpp ...
🌐
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
🌐
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 inside Base64 library: #include "Base64.h" #include #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: ...
Find elsewhere
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.

🌐
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, ...
🌐
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…
🌐
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
🌐
NewAE Forum
forum.newae.com › embedded security › chipwhisperer software
Avr folder is missing in avrcryptolib folder - ChipWhisperer Software - NewAE Forum
September 27, 2023 - I am trying to implement des on my target and currently facing following issue: …/./crypto/avrcryptolib//des/des.c:30:10: fatal error: avr/pgmspace.h: No such file or directory 30 | #include | ^~~~~~~~~~~~~~~~ compilation terminated. make[1]: *** […/./Makefile.inc:495: objdir-CWLITEARM/des.o] Error 1 make[1]: *** Waiting for unfinished jobs…
🌐
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…
🌐
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…
🌐
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
🌐
Arduino Forum
forum.arduino.cc › projects › programming
Use of Adafruit_SH1106 library cause fatal error: avr/pgmspace.h: No such file or directory compilation terminated - Programming - Arduino Forum
June 5, 2021 - Hi all, I'm implementing a simple internet radio based on ESP32. The original project, not mine, uses an SSD1306 based OLED display and, so far, it seems to work. The display is driven through libraries Adafruit_GFX and Adafruit_SSD1306. Unfortunately I've only a very small SSD1306 OLED display and I've switched to bigger OLED display driven by an SH1106.