This might be that you are choosing Generic ESP8266 as your board type in the IDE, rather than NodeMCU (which I assume is what you’re using).
Generic ESP8266 doesn’t support the digital pin aliases like “D2”, which may be causing the issue.
Otherwise you may be missing one of the Adafruit helper libraries that are needed to enable the Adafruit DHT library.
I also notice that you don’t have a board type un-commented in your Edgent sketch.
You should read this to understand how board types work, and which pins the Edgent sketch uses in the Settings.h file, so need to be avoided for sensors etc in your sketch…
Pete.