Device offline after 1 day

You can’t run C++ on a Pi without some sort of emulator software.
The only one that I’m aware of was WiringPi, and that is now deprecated.

Are you 100% tied to using the Pi as your board?
As I said earlier, I think Pis are great as servers, but they are far too expensive, cumbersome to set-up and slow to boot for use as a board to use as an interface for a DHT sensor.

Pete.