wonho-maker / Adafruit_SH1106

Adafruit graphic library for SH1106 dirver lcds.
Other
161 stars 94 forks source link

No such file or directory 31 | #include <util/delay.h> #19

Open rutuja0325 opened 9 months ago

rutuja0325 commented 9 months ago

No such file or directory 31 | #include <util/delay.h>

i am having this error again and again

vladikas commented 4 months ago

The library does not know how to work with ESP. Try using a different brunch. https://github.com/wonho-maker/Adafruit_SH1106/pull/16

rin67630 commented 2 months ago

I have the same issue. #16 tells that is does work on ESP8266, but I still do not know how to retrofit util/delay.h Would it be possible to provide the file in the library?

vladikas commented 2 months ago

I have the same issue.

You're doing something wrong. Check that in the file Adafruit_SH1106.cpp there were lines:

#ifdef __AVR__
    #include <avr/pgmspace.h>
    #ifndef __SAM3X8E__
        #include <util/delay.h>
    #endif
#elif defined(ESP8266) || defined(ESP32)
    #include <pgmspace.h>
#endif

I tried to compile an example from this library for the ESP8266 board. Everything worked out.

Andy2No commented 2 months ago

@rin67630 That sort of error normally indicates that you have a different boards support package than the one the code was written for. Espressif broke compatibility when they changed from 2.x to 3.x. If you have 3.x installed in Arduino, try uninstalling it then installing v2.0.17, in the boards manager. If you note the version, you can always put it back later.

I don't know which version this software was meant to support but it's a fair bet that it's not the one you have installed.

rin67630 commented 2 months ago

try uninstalling it then installing v2.0.17 I tried with V2.0.0 and with V2.0.1 Still cannot compile the exampes for a WemosD1 board. d:\Activities\3_Maker\libraries\Adafruit_SH1106-master\Adafruit_SH1106.cpp:29:26: fatal error: avr/pgmspace.h: No such file or directory

Andy2No commented 2 months ago

@rin67630 The main differences are between 1.x, 2,x and 3.x - Espressif broke backwards compatibility with each major release of its Arduino boards support package, and that tends to show up as missing header files and other components, when trying to compile software written for a different major version.

Andy2No commented 2 months ago

@rin67630

It seems util/delay.h is meant for AVRs (like the Uno) and defines different versions of delay, but the code here just uses the standard delay(), as far as I can see. So, try editing out or commenting out that line, in your copy, and see if that produces any more errors.

You should have a definition of delay() from the Espressif board support package - you might want to put that back to the version where you started (uninstall the current one, then install the other, or it can get confused). The problem #include doesn't look like it's needed. It's on line 31 of Adafruit_SH1106.cpp ;

#include <avr/pgmspace.h>
#ifndef __SAM3X8E__
 #include <util/delay.h>
#endif
#include <stdlib.h>
vladikas commented 2 months ago

I'll write again - use another branch. Apparently you are using the original version, which does not support ESP https://github.com/pedrosousabarreto/Adafruit_SH1106/tree/master