Use of Adafruit_SH1106 library cause fatal error: avr/pgmspace.h: No such file or directory compilation terminated

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.
I've therefore changed the display specific library to Adafruit_1106 and modified accordingly the constructor in the sketch.
Unfortunately the compilation fails giving the message:
"fatal error: avr/pgmspace.h: No such file or directory"
It happens both under IDE 1 and IDE 2, this latter a bit more cryptical about the error cause but, at the end, it turns out to be the same.
I wonder why it looks for pgmspace.h in the avr folder when I'm using an ESP32 microcontroller.
Has anybody any idea or suggestion to overcome this obstacle?
Thank you

Post the code that you are trying to compile

The easier you make it to read and copy your code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

If you get errors when compiling please copy them from the IDE using the "Copy error messages" button and paste the clipboard here in code tags

Here is the code:

[code]

/*
airspectrum.cdnstream1.com:8114/1648_128 #  1 - Easy Hits Florida 128k Y
109.206.96.34:8100                       #  0 - NAXI LOVE RADIO, Belgrade, Serbia
us2.internet-radio.com:8050              #  2 - CLASSIC ROCK MIAMI 256k
airspectrum.cdnstream1.com:8000/1261_192 #  3 - Magic Oldies Florida
airspectrum.cdnstream1.com:8008/1604_128 #  4 - Magic 60s Florida 60s Classic Rock
us1.internet-radio.com:8105              #  5 - Classic Rock Florida - SHE Radio
icecast.omroep.nl:80/radio1-bb-mp3       #  6 - Radio 1, NL
205.164.62.15:10032                      #  7 - 1.FM - GAIA, 64k
skonto.ls.lv:8002/mp3                    #  8 - Skonto 128k
94.23.66.155:8106                        #  9 - *ILR CHILL and GROOVE

 "http://wbgo.streamguys.net/wbgo96",
  "http://wbgo.streamguys.net/thejazzstream",
  "http://stream.srg-ssr.ch/m/rsj/mp3_128",
  "http://37.187.79.93:8368/stream2",
  "http://icecast.omroep.nl/3fm-sb-mp3",
  "http://beatles.purestream.net/beatles.mp3",
  "http://listen.181fm.com/181-beatles_128k.mp3",

VS1053 - connections detail
 XRST = EN (D3)
 MISO = D19
 MOSI = D23
 SCLK = D18
 VCC = 5V / 3.3 V
 Gnd = Gnd 
  
*/

// This ESP_VS1053_Library
#include <VS1053.h>

#include <Preferences.h>  //For reading and writing into the ROM memory
Preferences preferences;
unsigned int counter,old_counter,new_counter;

#include "helloMp3.h"
#include <WiFi.h>
#include <HTTPClient.h>
#include <esp_wifi.h>

//OLED 64*32 display headers
//#include <Wire.h>     // Inseriti 04/06
//#include <SPI.h>      // Inseriti 04/06
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
//#include <Adafruit_SH1106.h>
#define SCREEN_WIDTH 128 // OLED display width, in pixels // Inseriti 04/06
#define SCREEN_HEIGHT 64 // OLED display height, in pixels // Inseriti 04/06
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin) // Inseriti 04/06
#define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32 // Inseriti 04/06
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
//Adafruit_SH1106 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

char ssid[] = "Vodafone-34350430-2p4";    //  your network SSID (name) 
char pass[] = "i2jukebcpz4m7j2";   // your network password

char *host[7] = {"streaming.shoutcast.com","swr-swr1-bw.cast.addradio.de","/swr/swr1/bw/mp3/64/stream.mp3", "airspectrum.cdnstream1.com","skonto.ls.lv",
"icecast.omroep.nl","beatles.purestream.net"};
char *path[7] = {"/80sPlanet?lang=en-US","/swr/swr1/bw/mp3/64/stream.mp3","/1261_192","/1604_128","/mp3 ",
"/radio1-bb-mp3","/beatles.mp3"};
int   port[7] = {80,80,8000,8008,8002,80,80};

char *sname[7] = {"Southcast-US","addradio.de","swr/swr1/bw","airspectrum-cdn","skonto.ls.lv","icecast-NZ","beatles-bb"};


int change=13;
bool x=true;
int status = WL_IDLE_STATUS;
WiFiClient  client;
uint8_t mp3buff[32];   // vs1053 likes 32 bytes at a time

// Wiring of VS1053 board (SPI connected in a standard way)
#define VS1053_CS    32 //32
#define VS1053_DCS   33  //33
#define VS1053_DREQ  35 //15
#define VOLUME  100 // volume level 0-100
VS1053 player(VS1053_CS, VS1053_DCS, VS1053_DREQ);

void setup () {
//Begin display
//display.init();
display.begin();
display.display();
display.clearDisplay();
display.invertDisplay(false);
display.setTextSize(1);
//display.setFont(ArialMT_Plain_16);
//display.normalDisplay();
//display.clearDisplay();
display.setTextColor(SSD1306_WHITE);
display.setCursor(0, 0);
display.print("  ESP32 Radio");
//display.drawString(0,0,"ESP32 Radio");
display.setTextSize(1);
//display.setFont(ArialMT_Plain_10);
  
   pinMode(change,INPUT_PULLUP);
// initialize SPI
   Serial.begin(115200);
   delay(500);
// initialize SPI bus;
    SPI.begin();

// initialize VS1053 player
    player.begin();
//    player.switchToMp3Mode(); // optional, some boards require this
    player.setVolume(VOLUME);
   
   WiFi.begin(ssid, pass);
   while (WiFi.status() != WL_CONNECTED) {
  //  display.drawString(0,15,"   Connecting..");
    delay(500);
    Serial.print(".");
   }
  Serial.println("WiFi connected");  
  Serial.print("IP address:");  
  Serial.println(WiFi.localIP());
//  display.setColor(WHITE);
display.setTextColor(SSD1306_WHITE);
  String x1="Connected to:"+String(ssid[0])+String(ssid[1])+String(ssid[2])+String(ssid[3]);
  display.setCursor(0, 15);
  display.print(x1);
//  display.drawString(0,15,x1);
  x1="IP:"+WiFi.localIP().toString();
  display.setCursor(0, 27);
  display.print(x1);
//  display.drawString(0,27,x1);
 
preferences.begin("my-app", false);
counter = preferences.getUInt("counter", 0);
old_counter=counter;

String x3="Stn:"+String(counter);
String x4="Playing:"+String(sname[counter]);  //+ String(path[counter])+":"+String(port[counter]);  //.toString();
display.setCursor(80, 27);
display.print(x3);
display.setCursor(0, 37);
display.print(x4.substring(0,60));
//display.drawString(80,27,x3);
//display.drawString(0,37,x4.substring(0,60));
display.display();
x4="";
Serial.printf("Current counter value: %u\n", counter);
delay(100);
player.playChunk(hello2, sizeof(hello2)); //VS1053 is wake up & running
station_connect(counter); 
}

void loop() {
 
      if (client.available() > 0) {
      uint8_t bytesread = client.read(mp3buff, 32);
      player.playChunk(mp3buff, bytesread);
      }
      
    if(digitalRead(change)==0 and x==true){
    x=false;
    counter = counter+1;
    if(counter>6) counter=0;
    preferences.putUInt("counter",counter);
    new_counter=counter;
    Serial.printf("Set counter to new_value: %u\n", counter);
    delay(500); 

    if(old_counter != new_counter) {
  
    player.softReset(); 
    x=true;
    station_connect(new_counter); 
    preferences.putUInt("counter",new_counter); 

String x3="Stn:"+String(counter);
String x4="Playing:"+String(sname[counter]);  //+ String(path[counter])+":"+String(port[counter]);  //.toString();
display.clearDisplay();
//display.setFont(ArialMT_Plain_16);
display.setTextSize(1);
display.setCursor(0, 0);
display.print("ESP32 Radio");
//display.drawString(0,0,"  ESP32 Radio");
//display.setFont(ArialMT_Plain_10);
String x1="Connected to:"+String(ssid[0])+String(ssid[1])+String(ssid[2])+String(ssid[3]);
display.setCursor(0, 15);
display.print(x1);
//display.drawString(0,15,x1);
x1="IP:"+WiFi.localIP().toString();
display.setCursor(0, 27);
display.print(x1);
display.setCursor(80, 27);
display.print(x3);

//display.drawString(0,27,x1);
//display.drawString(80,27,x3);
//display.drawString(0,37,x4.substring(0,60));
display.setCursor(0, 37);
display.print(x4.substring(0,60));

display.display();
    }
  } 
}

void station_connect (int station_no ) {
    if (client.connect(host[station_no],port[station_no]) ) {
    Serial.println("Connected now");
     }
    Serial.print(host[station_no]);
    Serial.println(path[station_no]);
    client.print(String("GET ") + path[station_no] + " HTTP/1.1\r\n" +
               "Host: " + host[station_no] + "\r\n" + 
               "Connection: close\r\n\r\n");     
  }

[/code]
If you comment the two lines
#include <Adafruit_SSD1306.h>
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
and uncomment 
//#include <Adafruit_SH1106.h>
//Adafruit_SH1106 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
the compilation fails with the above mentioned error.
The compiler output is too long to be appended here.
Last details, I've deleted and reinstalled the SSD1306 and SH1106 libraries, just in case, after the first compilation error

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.