Code error "no matching function for call to...."

I've got the following codes from the internet as my project. But the error occurs and I don't know how to solve it. Please help. Thank you.

#include "DHT.h"
#include<LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

#define dht_dpin 12
DHT dht;

#define pwm 9
byte degree[8] =
{
0b00011,
0b00011,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000,
0b00000
};
void setup()
{
lcd.begin(16, 2);
lcd.createChar(1, degree);
lcd.clear();
lcd.print(" Fan Speed ");
lcd.setCursor(0,1);
lcd.print(" Controlling ");
delay(2000);
analogWrite(pwm, 255);
lcd.clear();
lcd.print("Circuit Digest ");
delay(2000);
}
void loop()
{
DHT.read11(dht_dpin);
int temp = DHT.temperature;
lcd.setCursor(0,0);
lcd.print("Temperature:");
lcd.print(temp); // Printing temperature on LCD
lcd.write(1);
lcd.print("C");
lcd.setCursor(0,1);
if(temp <26 )
{
analogWrite(9,0);
lcd.print("Fan OFF ");
delay(100);
}

else if(temp==26)
{
analogWrite(pwm, 51);
lcd.print("Fan Speed: 20% ");
delay(100);
}

else if(temp==27)
{
analogWrite(pwm, 102);
lcd.print("Fan Speed: 40% ");
delay(100);
}

else if(temp==28)
{
analogWrite(pwm, 153);
lcd.print("Fan Speed: 60% ");
delay(100);
}

else if(temp==29)
{
analogWrite(pwm, 204);
lcd.print("Fan Speed: 80% ");
delay(100);
}
else if(temp>29)
{
analogWrite(pwm, 255);
lcd.print("Fan Speed: 100% ");
delay(100);
}
delay(3000);
}

The error message says:

Arduino: 1.6.9 (Windows 8.1), Board: "Arduino/Genuino Uno"

sketch_sep06a:8: error: no matching function for call to 'DHT::DHT()'

DHT dht;

^

C:\Users\Something\Desktop\sketch_sep06a\sketch_sep06a.ino:8:5: note: candidates are:

In file included from C:\Users\Something\Desktop\sketch_sep06a\sketch_sep06a.ino:1:0:

C:\Program Files (x86)\Arduino\libraries\DHT_sensor_library/DHT.h:40:4: note: DHT::DHT(uint8_t, uint8_t, uint8_t)

DHT(uint8_t pin, uint8_t type, uint8_t count=6);

^

C:\Program Files (x86)\Arduino\libraries\DHT_sensor_library/DHT.h:40:4: note: candidate expects 3 arguments, 0 provided

C:\Program Files (x86)\Arduino\libraries\DHT_sensor_library/DHT.h:38:7: note: constexpr DHT::DHT(const DHT&)

class DHT {

^

C:\Program Files (x86)\Arduino\libraries\DHT_sensor_library/DHT.h:38:7: note: candidate expects 1 argument, 0 provided

C:\Program Files (x86)\Arduino\libraries\DHT_sensor_library/DHT.h:38:7: note: constexpr DHT::DHT(DHT&&)

C:\Program Files (x86)\Arduino\libraries\DHT_sensor_library/DHT.h:38:7: note: candidate expects 1 argument, 0 provided

C:\Users\Something\Desktop\sketch_sep06a\sketch_sep06a.ino: In function 'void loop()':

sketch_sep06a:38: error: expected unqualified-id before '.' token

DHT.read11(dht_dpin);

^

sketch_sep06a:39: error: expected primary-expression before '.' token

int temp = DHT.temperature;

^

exit status 1
no matching function for call to 'DHT::DHT()'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

It is best if you could refer to the example sketch that came with the library. You have incorrectly declared your DHT sensor, and the methods called are invalid.

DHT dht; //Change to code below

#define DHTTYPE DHT22 
DHT dht(dht_dpin, DHTTYPE);
DHT.read11(dht_dpin); //Remove this
int temp = DHT.temperature; //This function returns a float, dht are small letters, change to code below

float temp = dht.readTemperature();

Thanks a lot. It works, but didn't try it with the circuit yet. Thanks again.

You have to read the error messages (and also use code tags!).

candidate expects 3 arguments, 0 provided

You provided 0 arguments to the constructor, which it is not designed to operate with.


Later on:

DHT.read11(dht_dpin);

DHT is the class, not an instance of the class. Try:

dht.read11(dht_dpin);

It's like saying "I took dog for a walk" (well, some people might talk like that). You should say "I took Fido for a walk" where Fido is an instance of the class dog.

this is my code

#include "DHT.h"
#include <LiquidCrystal.h>
#define DHTPin 2
LiquidCrystal lcd(1, 3, 4, 5, 6, 7);
#define dht_dpin 12 
#define DHTTYPE DHT22 
DHT dht(dht_dpin, DHTTYPE);


void setup() 
{
   lcd.begin(16,2);
}

void loop()
{
 float temp = dht.getTemperature();
 float humi =dht.getHumidity();
 lcd.setCursor(0,0);
 lcd.print("Temp: ");
 lcd.print(temp);
 lcd.print(" C");
 lcd.setCursor(0,1);
 lcd.print("Humi");
 lcd.print(humi);
 lcd.print(" %");
 delay(2000);
}

this error ocurs

Arduino: 1.8.5 (Windows 7), Board: "Arduino/Genuino Uno"

C:\Users\a\Documents\Arduino\ajinkya\ajinkya.ino: In function 'void loop()':

ajinkya:17: error: 'class DHT' has no member named 'getTemperature'

float temp = dht.getTemperature();

^

ajinkya:18: error: 'class DHT' has no member named 'getHumidity'

float humi =dht.getHumidity();

^

exit status 1
'class DHT' has no member named 'getTemperature'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

So open up DHT.h and find out what the methods are.

But most importantly, don't hijack an old thread. Start your own.