why did you not use a working example-code for DS18B20??
https://www.google.de/search?as_q=arduino+DS18B20+democode
Assuming that all sensors work the same way is a very wrong assumption.
With a democode for DS18B20 non of your errors would occur!
For asking how to solve compiler-error-messages
For posting multiple postings in a short time, the new member has to get to Discourse trust level one on the forum, which is a pretty trivial matter:
Get to trust level 1 by…
- reading at least 5 topics
- Reading at least 30 posts
- Spend a total of 10 minutes reading posts
best regards Stefan