Variables not declared in this scope

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#include <SimpleTimer.h>
#include <DHT.h>

char auth[] = "TB6KiXEXlQvFAVTDlSbrquq0x3qFo3Bp"; 
char ssid[] = "sneha123";  
char pass[] = "asdfghjkl";  


#define exhaust_Fan D3
#define DHTPIN D2          // Digital pin D2
#define MoistureSensor D1       // digitalpin D1 
float  moisture; 
#define DHTTYPE DHT11     // DHT 11
int temp;
DHT dht(DHTPIN, DHTTYPE);
SimpleTimer timer;

#define motor D8
#define button D7
int buttonState; 
#define CoSensor A0
int CoLevel;


WidgetTerminal terminal(V1);

BLYNK_WRITE(V1)
{
    terminal.write(param.getBuffer(), param.getLength());
    terminal.println();

  // Ensure everything is sent
  terminal.flush();
}

void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  float moisture = analogRead(MoistureSensor);  
  moisture = map(moisture,1023,0,0,100);  
  float CoLevel = analogRead(CoSensor);
  float Covalue =  map(CoLevel, 0, 1023, 0, 100); 
  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V4, moisture);  //V4 is for moisture  
  Blynk.virtualWrite(V5, h);  //V5 is for Humidity
  Blynk.virtualWrite(V6, t);  //V6 is for Temperature
  Blynk.virtualWrite(V3, Covalue);  //V7 is for pollution

}

void setup()
{
  Serial.begin(9600); // See the connection status in Serial Monitor
  Blynk.begin(auth, ssid, pass);

  dht.begin();
  pinMode(MoistureSensor ,INPUT);
  pinMode(button, INPUT);  
  pinMode(motor, OUTPUT);
  pinMode(CoSensor ,INPUT);
  // Setup a function to be called every second
  timer.setInterval(1000L, sendSensor);
  terminal.flush();
  pinMode(exhaust_Fan , OUTPUT);
}

void loop()
{  
  
  buttonState = digitalRead(button);
  Serial.print("buttonState: ");
  Serial.println(buttonState);
  delay(50);
  terminal.print("buttonState: ");
  terminal.println(buttonState);    
  delay(50);

  moisture = analogRead(MoistureSensor);  
  moisture = map(moisture,1023,0,0,100);
  Serial.print("moisture: ");
  Serial.print(moisture);
  Serial.println("%");  
  terminal.print("moisture: ");
  terminal.print(moisture);
  terminal.println("%");
  temp = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
  Serial.print("temp: ");
  Serial.print(temp);
  Serial.println(" c");  
  terminal.print("temp: ");
  terminal.print(temp);
  terminal.println(" c");
  delay(300);
  CoLevel = analogRead(CoSensor);
  int Covalue =  map(CoLevel, 0, 1023, 0, 100);
  Serial.print("Covalue: ");
  Serial.print(Covalue);
  Serial.println(" %");  
  terminal.print("Covalue: ");
  terminal.print(Covalue);
  terminal.println(" %");
  delay(300);    
  if(buttonState == LOW){
      selfmode();  
    }

   terminal.flush();
     
  Blynk.run(); // Initiates Blynk
  timer.run(); // Initiates SimpleTimer
}

void selfmode(){
  

    Serial.println("AutoMode");
    delay(100);
    terminal.println("AutoMode");
    delay(200);
   
    if (moisture == 0 ){
      Serial.println("Dry land: motor is on for a while");
      terminal.println("Dry land: motor is on for a while");      
      digitalWrite(motor, HIGH);
      delay(5000);
      digitalWrite(motor, LOW);
      delay(300);      
      }
    else if (temp >= 35){
      Serial.println("High temperature: exhaust_Fan is on for a while");
      terminal.println("High temperature:exhaust_Fan is on for a while");         
      digitalWrite(exhaust_Fan, HIGH);
      delay(4000);
      digitalWrite(exhaust_Fan, LOW);
      delay(300);      
      }
     else{
      digitalWrite(motor, LOW); 
      digitalWrite(exhaust_Fan , LOW);     
      } 
   
  
  }

You must show the error which will identify the scope and variable.

iot:16:16: error: 'D2' was not declared in this scope; did you mean 'V2'?
   16 | #define DHTPIN D2          // Digital pin D2
      |                ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:21:9: note: in expansion of macro 'DHTPIN'
   21 | DHT dht(DHTPIN, DHTTYPE);
      |         ^~~~~~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino: In function 'void sendSensor()':
iot:17:24: error: 'D1' was not declared in this scope; did you mean 'y1'?
   17 | #define MoistureSensor D1       // digitalpin D1
      |                        ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:46:31: note: in expansion of macro 'MoistureSensor'
   46 |   float moisture = analogRead(MoistureSensor);
      |                               ^~~~~~~~~~~~~~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino: In function 'void setup()':
iot:17:24: error: 'D1' was not declared in this scope; did you mean 'y1'?
   17 | #define MoistureSensor D1       // digitalpin D1
      |                        ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:69:11: note: in expansion of macro 'MoistureSensor'
   69 |   pinMode(MoistureSensor ,INPUT);
      |           ^~~~~~~~~~~~~~
iot:25:16: error: 'D7' was not declared in this scope; did you mean 'V7'?
   25 | #define button D7
      |                ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:70:11: note: in expansion of macro 'button'
   70 |   pinMode(button, INPUT);
      |           ^~~~~~
iot:24:15: error: 'D8' was not declared in this scope; did you mean 's8'?
   24 | #define motor D8
      |               ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:71:11: note: in expansion of macro 'motor'
   71 |   pinMode(motor, OUTPUT);
      |           ^~~~~
iot:15:21: error: 'D3' was not declared in this scope; did you mean 'V3'?
   15 | #define exhaust_Fan D3
      |                     ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:76:11: note: in expansion of macro 'exhaust_Fan'
   76 |   pinMode(exhaust_Fan , OUTPUT);
      |           ^~~~~~~~~~~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino: In function 'void loop()':
iot:25:16: error: 'D7' was not declared in this scope; did you mean 'V7'?
   25 | #define button D7
      |                ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:82:29: note: in expansion of macro 'button'
   82 |   buttonState = digitalRead(button);
      |                             ^~~~~~
iot:17:24: error: 'D1' was not declared in this scope; did you mean 'y1'?
   17 | #define MoistureSensor D1       // digitalpin D1
      |                        ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:90:25: note: in expansion of macro 'MoistureSensor'
   90 |   moisture = analogRead(MoistureSensor);
      |                         ^~~~~~~~~~~~~~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino: In function 'void selfmode()':
iot:24:15: error: 'D8' was not declared in this scope; did you mean 's8'?
   24 | #define motor D8
      |               ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:136:20: note: in expansion of macro 'motor'
  136 |       digitalWrite(motor, HIGH);
      |                    ^~~~~
iot:15:21: error: 'D3' was not declared in this scope; did you mean 'V3'?
   15 | #define exhaust_Fan D3
      |                     ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:144:20: note: in expansion of macro 'exhaust_Fan'
  144 |       digitalWrite(exhaust_Fan, HIGH);
      |                    ^~~~~~~~~~~
iot:24:15: error: 'D8' was not declared in this scope; did you mean 's8'?
   24 | #define motor D8
      |               ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:150:20: note: in expansion of macro 'motor'
  150 |       digitalWrite(motor, LOW);
      |                    ^~~~~
iot:15:21: error: 'D3' was not declared in this scope; did you mean 'V3'?
   15 | #define exhaust_Fan D3
      |                     ^~
C:\Users\DEFAULT.DESKTOP-41PDA0U\Downloads\water\iot\iot.ino:151:20: note: in expansion of macro 'exhaust_Fan'
  151 |       digitalWrite(exhaust_Fan , LOW);
      |                    ^~~~~~~~~~~
exit status 1
'D2' was not declared in this scope; did you mean 'V2'?

take a moment and read this: How to get the best out of this forum - Using Arduino / Installation & Troubleshooting - Arduino Forum

It will help people help you. Your code and error codes need to be surrounded by code tags. It makes copy & paste much easier as well as avoiding odd formatting.

Done. Any idea why my code is getting so many errors?

which processor type did you select under Tools->board?

seems like the error are associated with pin definitons (e.g. D0)

THANK YOU!! FIXED IT