fatal error: avr/io.h: No such file or directory arduino

11,003

It looks like you are using some old version of the library (from 2012).

The latest version, which does not contain the problematic "extern" block, can be found here: https://github.com/adafruit/DHT-sensor-library

(The default example works nicely with my Arduino Nano v3.0 and DHT22 sensor)

Share:
11,003
William Bello
Author by

William Bello

I'm a ASP.NET software developer with 1+ of experience. Willing to grow in technical and personal skills while working in a team space. I'm always trying improve my coding skills by following the SOLID principle and others best practices. I also like to collaborate on open source projects. May the code be with you

Updated on June 05, 2022

Comments

  • William Bello
    William Bello almost 2 years

    I'm trying to test a library for an DHT22 "Temperature Sensor", but I got an error while including an internal arduino library from the DHT.cpp file

    I got this error:

    C:\Program Files (x86)\Arduino\libraries\DHT\DHT22.cpp:56:20:
    fatal error: avr/io.h: No such file or directory  #include <avr/io.h>
    

    In the DHT22.cpp, this is the the block of error

    extern "C" {
     #include <avr/io.h>
     #include <avr/interrupt.h>
     #include <avr/pgmspace.h>
    }
    

    I got in the conclusion that the library is not finding the avr folder which is in C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include\avr I checked another built-in library servo.cpp and this is the include part

    #include <avr/interrupt.h>
    #include <Arduino.h>
    

    but the last one works without errors, my question is why the DHT library is not importing the required files and the servo does ?