Error with DHT.h library

Hello All,

I am having trouble getting the DHT library to install (used for the DHT11 temperature/humidity sensor). I have downloaded the library shown in the attached image. However, whenever I try to include the library, I get the error message shown below. Furthermore, this library shows up under "Recommended Libraries" in my Arduino IDE as opposed to "Contributed libraries". Does anyone have any suggestion as to what is happening?

Thank you,

Dustin

Error message below:

Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino/Genuino Uno"

In file included from C:\Users\dusti\Desktop\TestSketch\TestSketch.ino:2:0:

C:\Users\dusti\Documents\Arduino\libraries\DHT_sensor_library/DHT_U.h:38:10: error: conflicting return type specified for 'virtual bool DHT_Unified::Temperature::getEvent(sensors_event_t*)'

bool getEvent(sensors_event_t* event);

^

In file included from C:\Users\dusti\Documents\Arduino\libraries\DHT_sensor_library/DHT_U.h:25:0,

from C:\Users\dusti\Desktop\TestSketch\TestSketch.ino:2:

C:\Users\dusti\Documents\Arduino\libraries\AdafruitSensor/Adafruit_Sensor.h:146:16: error: overriding 'virtual void Adafruit_Sensor::getEvent(sensors_event_t*)'

virtual void getEvent(sensors_event_t*);

^

In file included from C:\Users\dusti\Desktop\TestSketch\TestSketch.ino:2:0:

C:\Users\dusti\Documents\Arduino\libraries\DHT_sensor_library/DHT_U.h:50:10: error: conflicting return type specified for 'virtual bool DHT_Unified::Humidity::getEvent(sensors_event_t*)'

bool getEvent(sensors_event_t* event);

^

In file included from C:\Users\dusti\Documents\Arduino\libraries\DHT_sensor_library/DHT_U.h:25:0,

from C:\Users\dusti\Desktop\TestSketch\TestSketch.ino:2:

C:\Users\dusti\Documents\Arduino\libraries\AdafruitSensor/Adafruit_Sensor.h:146:16: error: overriding 'virtual void Adafruit_Sensor::getEvent(sensors_event_t*)'

virtual void getEvent(sensors_event_t*);

^

exit status 1
Error compiling for board Arduino/Genuino Uno.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Update: I've tried deleting and re-installing all Adruino software. Still, this issue persists. Any suggestions would be greatly appreciated!

Try this:

  • Delete the C:\Users\dusti\Documents\Arduino\libraries\AdafruitSensor folder. Please be very careful when deleting things on your computer. When in doubt, back up!
  • (In the Arduino IDE) Sketch > Include Library > Manage Libraries
  • Wait for the download to finish.
  • In the "Filter your search" field, type "adafruit unified sensor".
  • Press Enter.
  • Scroll down to the bottom of the search results.
  • Click on "Adafuit Unified Sensor by Adafruit".
  • Click the "Install" button.
  • Wait for the installation to finish.
  • Click the "Close" button.
  • Try compiling your sketch again.

Did that solve the error?

Hello pert,

First, thanks for the very detailed reply and instructions. I followed exactly what you said to do, and it worked perfectly!

All of the "Adafruit" libraries still show up under "Recommended libraries", but the sketch will compile which is ultimately all I care about.

Thanks again for taking the time to write out such clear instructions.

Dustin

You're welcome. I'm glad to hear it's working now. Enjoy!
Per