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
🌐
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

"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
<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
Fatal error: pgmspace.h: No such file or directory Help!
Hi all, My library is currently using the Base64 library. 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. More on forum.arduino.cc
🌐 forum.arduino.cc
0
0
October 31, 2022
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
🌐
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
🌐
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
🌐
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 ...
🌐
Arduino Forum
forum.arduino.cc › projects › programming
Fatal error: pgmspace.h: No such file or directory Help! - Programming - Arduino Forum
October 31, 2022 - Hi all, My library is currently using the Base64 library. There are several lines of code inside Base64 library: #include "Base64.h" #include <Arduino.h> #if (defined(__AVR__)) #include <avr/pgmspace.h> #else #include <…
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.

Find elsewhere
🌐
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
🌐
GitHub
github.com › wayoda › LedControl › issues › 56
fatal error: avr/pgmspace.h: No such file or directory 30 | #include <avr/pgmspace.h> · Issue #56 · wayoda/LedControl
October 15, 2024 - fatal error: avr/pgmspace.h: No such file or directory 30 | #include <avr/pgmspace.h>#56 · Copy link · AlpoReyz · opened · on Oct 15, 2024 · Issue body actions · Why · Reactions are currently unavailable · No one assigned · No labels · No labels · No projects ·
Author   AlpoReyz
🌐
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 › qmk › qmk_firmware › issues › 901
avr/pgmspace.h: No such file or directory · Issue #901 · qmk/qmk_firmware
November 24, 2016 - Size before: text data bss dec hex filename 0 22852 0 22852 5944 s60-x_donkey.hex Compiling: ../../keyboards/s60-x/s60-x.c In file included from ../../keyboards/s60-x/s60-x.h:23:0, from ../../keyboards/s60-x/s60-x.c:1: ../../quantum/quantum.h:5:26: fatal error: avr/pgmspace.h: No such file or directory #include <avr/pgmspace.h> ^ compilation terminated.
Author   wyudong
🌐
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 - After changing in TheThingsNetwork.h from: #include <avr/pgmspace.h> to #include <pgmspace.h> it compiles.
Author   jstrobel
🌐
Arduino Forum
forum.arduino.cc › projects › programming
Sys/pgmspace.h no such file - Programming - Arduino Forum
May 20, 2022 - I'm using Arch Linux. When I try to compile code, it output error: In file included from /home/guts/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/Arduino.h:283, from sketch/sketch_may20a.ino.cpp:1: /home/guts/.arduino15/packages/esp8266/hardware/esp8266/3.0.2/cores/esp8266/pgmspace.h:8:10: fatal error: sys/pgmspace.h: No such file or directory #include ^~~~~~~~~~~~~~~~ compilation terminated. exit status 1 Error compiling for board...
🌐
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 › 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
🌐
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…
🌐
Arduino Forum
forum.arduino.cc › international › italiano › software
fatal error: avr\pgmspace.h: No such file or directory - Software - Arduino Forum
July 10, 2013 - Salve a tutti, sto cercando di compilare uno sketch per mettere ora e data su un display LCD. Fortunatamente ho trovato uno sketch sul web che mi potrebbe essere utile (enc28j60_tutorial/_13_NTP.ino at master · lucadentella/enc28j60_tutorial · GitHub), ma quando cerco di compilarlo mi da: ...EtherCard.h:37: fatal error: avr\pgmspace.h: No such file or directory Ho controllato su tutte le cartelle avr di Arduino e il file in questione sembra esserci...