Error:expected declaration before { token. (Havent i already declared it?) I'm getting the error message:

sketch_dec31d.ino: In function 'void setup()':
sketch_dec31d:20: error: expected unqualified-id before '.' token
sketch_dec31d.ino: In function 'void loop()':
sketch_dec31d:29: error: expected primary-expression before '.' token
sketch_dec31d:31: error: expected primary-expression before '.' token
sketch_dec31d:33: error: expected primary-expression before '.' token
sketch_dec31d:43: error: expected primary-expression before '.' token


This is the code:

#include &lt;dht.h&gt;     // what pin we're connected to
#define DHTTYPE DHT11   // DHT 11 
#define DHT11_PIN 2 

// Initialize DHT sensor for normal 16mhz Arduino


String TextForSms ;
String humidity = " Humidity: %";
String temperature = "   Temperature";
String sign = " *C";

char fromc; // character from computer

void setup() {
  Serial.begin(9600); 
 // Serial.println("DHT11 test!");

  dht.begin();
}

void loop() {
  // Wait a few seconds between measurements.
  delay(2000);

  // Reading temperature or humidity takes about 250 milliseconds!
  // Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
  int h = dht.readHumidity();
  // Read temperature as Celsius
  int t = dht.readTemperature();
  // Read temperature as Fahrenheit
  int f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // Compute heat index
  // Must send in temp in Fahrenheit!
  int hi = dht.computeHeatIndex(f, h);



   TextForSms = TextForSms + t + "," + h + ",";
Serial.println(TextForSms); 
     TextForSms = ""; 
   delay(1000);   

}
Probably the error is in line

dht.begin();


You did not declare the variable dht, probably of type DHT11 ? You can find the correct class name in the dht.h header file.

After checking this (random) website compute heat index arduino about DHT11 I see the line:

DHT dht(DHTPIN, DHTTYPE);


Which you also have to add, probably as:

DHT dht(DHT11_PIN, DHTTYPE);