There is no compiler error but output is showing timeout error. as per as the instruction given in https://github.com/RobTillaart/Arduino/issues/61
The DHT11 and DHT22 used to be cheap and easy to use humidity and temperature sensors when they were used together with an Arduino Uno.
But things have changed.
- They are not accurate and can become totally inaccurate with certain gasses or fumes.
- It turned out, that the most used DHT libraries have a serious bug that creates a shortcut in the datasignal. This was no problem with the Arduino Uno, which can output 40 mA with a pin. The newer processors have problems with that shortcut.
- In 2018 the DHT11 seems to behave differently, the internal controller has probably changed.
- Because the communication with the sensors requires accurate timing, the interrupts are turned off temporarily. That was no problem with the slow Arduino Uno, but it is not normal with a faster processor.
- Some libraries use a timeout with a loop or with clock cycles. That worked well with the Arduino Uno, but it is not always reliable with newer processors.
In 2018, all the DHT libraries for the ESP8266 and ESP32 have issues with the DHT11 and DHT22.
Since the sensors are not very accurate anyway, it is best to stay away from all the troubles and avoid them. There are a number of good humidity sensors with I2C interface.