lcd.print("IP: "); Will not compile in main loop.

In the following program it compiles and works ok.
If I add any commands that use a library in the main loop it wont compile.
The error states" "lcd" was not declared in this scope".
The same commands compile and work in setup

Any help would appreciated

This is a simple program that serves live data to a client without pushing refresh.

#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <LiquidCrystal_I2C.h>
#include "index.h" //Our HTML webpage contents with javascripts
#include <Wire.h>
#include <Adafruit_ADS1015.h>
#define LED 2  //On board LED

Adafruit_ADS1115 ads(0x48);
float Voltage = 0.0;
int cnt = 1;
//SSID and Password of your WiFi router
const char* ssid = "";
const char* password =  "";

ESP8266WebServer server(80); //Server on port 80

//===============================================================
// This routine is executed when you open its IP in browser
//===============================================================
void handleRoot() {
 String s = MAIN_page; //Read HTML contents
 server.send(200, "text/html", s); //Send web page
}

void handleADC() {
 int16_t adc0;  // we read from the ADC, we have a sixteen bit integer as a result

  adc0 = ads.readADC_SingleEnded(0);
  Voltage = (adc0 * 0.1875)/1000;
  
  
      String adcValue = String(cnt);         //String adcValue = String(Voltage);
 
 server.send(200, "text/plane", adcValue); //Send ADC value only to client ajax request
}

void handleLED() {
 String ledState = "OFF";
 String t_state = server.arg("LEDstate"); //Refer  xhttp.open("GET", "setLED?LEDstate="+led, true);
 Serial.println(t_state);
 if(t_state == "1")
 {
  digitalWrite(LED,LOW); //LED ON
  ledState = "ON"; //Feedback parameter
 }
 else
 {
  digitalWrite(LED,HIGH); //LED OFF
  ledState = "OFF"; //Feedback parameter  
 }
 
 server.send(200, "text/plane", ledState); //Send web page
}
//==============================================================
//                  SETUP
//==============================================================
void setup(void){
  ads.begin();
  Serial.begin(115200);
  
  WiFi.begin(ssid, password);     //Connect to your WiFi router
  Serial.println("");

  //Onboard LED port Direction output
  pinMode(LED,OUTPUT); 
  
  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }

  //If connection successful show IP address in serial monitor
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());  //IP address assigned to your ESP
    LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // 
    lcd.begin(40,4);
    lcd.backlight();//Power on the back light
lcd.setCursor(0,0); //we start writing from the first row first column
lcd.print(" livelcd"); //16 characters poer line
delay(1000);//Delay used to give a dinamic effect
 lcd.setCursor(0,0); 
  lcd.print("IP: ");
  lcd.print(WiFi.localIP());
 


  
  server.on("/", handleRoot);      //Which routine to handle at root location. This is display page
  server.on("/setLED", handleLED);
  server.on("/readADC", handleADC);

  server.begin();                  //Start server
  Serial.println("HTTP server started");
}
//==============================================================
//                     LOOP
//==============================================================
void loop(void)
{
  server.handleClient();          //Handle client requests
  cnt = cnt + 1;
 lcd.print("IP: ");
 }

Good job using code tags on your first post.

The error states" "lcd" was not declared in this scope".

The instantiation of the lcd object should be of global scope. Typically you would organize like this before setup()

#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE);

Thank you very much.
It worked