exit status 'dht' does not name a type

This is the code for a temperature and humidity sensor, and I have the Arduino main DHT master library, but it is not being used, even when I include that library.

#include <DHT.h>


    /*  DHT11/ DHT22 Sensor Temperature and Humidity Tutorial
     *  Program made by Dejan Nedelkovski,
     *  www.HowToMechatronics.com 
     */
    /*
     * You can find the DHT Library from Arduino official website
     * https://playground.arduino.cc/Main/DHTLib
     */
    #include <LiquidCrystal.h> // includes the LiquidCrystal Library
    #include <dht.h>
    #define dataPin 2
    LiquidCrystal lcd(1, 2, 4, 5, 6, 7); // Creates an LCD object. Parameters: (rs, enable, d4, d5, d6, d7)
    dht DHT;
    void setup() {
      lcd.begin(16,2); // Initializes the interface to the LCD screen, and specifies the dimensions (width and height) of the display
    }
    void loop() {
      int readData = DHT.read22(dataPin);
      float t = DHT.temperature;
      float h = DHT.humidity;
      lcd.setCursor(0,0); // Sets the location at which subsequent text written to the LCD will be displayed
      lcd.print("Temp.: "); // Prints string "Temp." on the LCD
      lcd.print(t); // Prints the temperature value from the sensor
      lcd.print(" C");
      lcd.setCursor(0,1);
      lcd.print("Humi.: ");
      lcd.print(h);
      lcd.print(" %");
      delay(2000);
    }

Temp_Humid.ino:20: error: 'dht' does not name a type
dht DHT;
^
/home/rob/Arduino/Temp_Humid.ino/Temp_Humid.ino/Temp_Humid.ino.ino: In function 'void loop()':
Temp_Humid.ino:25: error: expected primary-expression before '.' token
int readData = DHT.read22(dataPin);
^
Temp_Humid.ino:26: error: expected primary-expression before '.' token
float t = DHT.temperature;
^
Temp_Humid.ino:27: error: expected primary-expression before '.' token
float h = DHT.humidity;
^
Multiple libraries were found for "DHT.h"
Used: /home/rob/Arduino/libraries/DHT
Not used: /home/rob/Arduino/libraries/arduino-DHT-master
Not used: /home/rob/Arduino/libraries/DHT_sensor_library
Not used: /home/rob/Downloads/arduino-1.8.5/libraries/arduino-DHT-master
Not used: /home/rob/Downloads/arduino-1.8.5/libraries/DHT-sensor-library-master
Multiple libraries were found for "LiquidCrystal.h"
Used: /home/rob/Arduino/libraries/LiquidCrystal
Not used: /home/rob/Arduino/libraries/Newliquidcrystal_1.3.5
Not used: /home/rob/Downloads/arduino-1.8.5/libraries/Newliquidcrystal_1.3.5
Not used: /home/rob/Downloads/arduino-1.8.5/libraries/LiquidCrystal
Using library DHT in folder: /home/rob/Arduino/libraries/DHT (legacy)
Using library LiquidCrystal in folder: /home/rob/Arduino/libraries/LiquidCrystal (legacy)
exit status 1
'dht' does not name a type

What procedure did you follow to include the DHT library?

ieee488:
What procedure did you follow to include the DHT library?

I downloaded the Arduino DHT master library, then extracted it into the Arduino-1.8.5 library directory.

By your question, I guess that I have not done it correctly!

avvy66:
By your question, I guess that I have not done it correctly!

You are correct. :slight_smile:

.

So how should I install downloaded libraries to the Arduino IDE library directory.

When I googled how to install downloaded library files to Arduino, there were many links just saying they could be manually added or added from a zip.

Ok so what have I done wrong if that is the case.

Which library?

Properly written libraries can be added from the IDE.
If not, add it manually.

.

ieee488:
Which library?

Properly written libraries can be added from the IDE.
If not, add it manually.

.

The libarary was the arduino-DHT-master, and I just extracted it from a zip file into the arduino library. But you said that I did not install it properly or the correct way, so which is the correct way.

It still leaves me with the original problem of dht does not name a type

avvy66:
The libarary was the arduino-DHT-master, and I just extracted it from a zip file into the arduino library. But you said that I did not install it properly or the correct way, so which is the correct way.

It still leaves me with the original problem of dht does not name a type

Edit: where did #include <DHT.h> in first line come from ?

None of the examples for that library has it!

ieee488:
Edit: where did #include <DHT.h> in first line come from ?

None of the examples for that library has it!

I must have included it from the list in the library menu.

I 'm not using examples as the code is froma youtube video on using a DHT22 with the arduino to measure temperature and humidity.

I have 3 DHT libraries: arduino_DHT-master, DHT and DHT-sensor-library-master.

So what do I do to get rid of the error message.
Thanks

avvy66:
I must have included it from the list in the library menu.

I 'm not using examples as the code is froma youtube video on using a DHT22 with the arduino to measure temperature and humidity.

I have 3 DHT libraries: arduino_DHT-master, DHT and DHT-sensor-library-master.

So what do I do to get rid of the error message.
Thanks

Why do you need 3 DHT libraries?

As I use linux, I found on Adafruits website that the library folder for Ardiuno is under the sketchbook folder. so I have copied the relevant libraries to the sketchbook/library folder.

I still get the same error

avvy66:
As I use linux, I found on Adafruits website that the library folder for Ardiuno is under the sketchbook folder. so I have copied the relevant libraries to the sketchbook/library folder.

I still get the same error

I was able to compile your sketch just fine after fixing the error.

I am on Linux Mint 18.

ieee488:
I was able to compile your sketch just fine after fixing the error.

I am on Linux Mint 18.

On your question as to why I need 3 libraries is because each of the different temp plus humidity projects on youtube either say or include a link to the DHT library they have used for their project.

Well what was the error ? Please tell.

I am using Linux Ubuntu 18.04

Use the original example sketch.

Do not make changes unless you know what you are doing which you clearly don't.

i have been away for a week, and now a suitable reply.

First you suggested / told / inferred that I did not install the library the correct way, but when asked what was the correct way, you declined to answer me.

Then you told me a few days later that the code compiled ok after you removed the error. I asked you what was the error, but again you declined to answer or tell me what it was..

Maybe it is you that you clearly don't know what you are doing.

If you don't know what you are doing why do you waste people's time with half cocked answers.

avvy66:
If you don't know what you are doing why do you waste people's time with half cocked answers.

If you don't know what you're doing, why are you wasting your own time posting in a section clearly marked "For problems with Arduino itself, NOT your project"?

To the mod who removed my post:

I see your point but why didn't you take the same action agains leee488 who wasted my time also.

Bias methinks

avvy66:
To the mod who removed my post:

None of your posts have been removed.

I see your point but why didn't you take the same action agains leee488 who wasted my time also.

Bias methinks

Please explain.
Take all the time you need.

Ok, there are many derivities, but I'll try to keep it simple.

After my initial post with the included code ieee488 asked:

What procedure did you follow to include the DHT library?

My reply:
I downloaded the Arduino DHT master library, then extracted it into the Arduino-1.8.5 library directory.

By your question, I guess that I have not done it correctly!

ieee488 replied:
You are correct. :slight_smile:

I then asked:
So how should I install downloaded libraries to the Arduino IDE library directory.

I also replied here:
When I googled how to install downloaded library files to Arduino, there were many links just saying they could be manually added or added from a zip.

Ok so what have I done wrong if that is the case.

ieee488
Which library?

Properly written libraries can be added from the IDE.
If not, add it manually.

AWOL Please note:
ieee488 did not tell me how to install the libraries even after I asked how.

So I added:
As I use linux, I found on Adafruits website that the library folder for Ardiuno is under the sketchbook folder. so I have copied the relevant libraries to the sketchbook/library folder.

I still get the same error

My reply again:
The libarary was the arduino-DHT-master, and I just extracted it from a zip file into the arduino library. But you said that I did not install it properly or the correct way, so which is the correct way.

It still leaves me with the original problem of dht does not name a type

ieee488 asked:
Edit: where did #include <DHT.h> in first line come from ?

None of the examples for that library has it!

ieee488 replied:
I was able to compile your sketch just fine after fixing the error.

I am on Linux Mint 18.

My question:
Well what was the error ? Please tell.
Use the original example sketch.

Do not make changes unless you know what you are doing which you clearly don't.

ieee488 replied:
Use the original example sketch.

Do not make changes unless you know what you are doing which you clearly don't.

So you can see that I did not rreceive and answers on the problem I have from ieee488, as he seems to have just strung me along. So I told him he was a time waster

AWOL:
I have seen that other members of the forum also have posted question to do with projects, but yet you castigate me for doing the same.!