Using WiFiClient in ESP8266WiFi.h

I'm using Arduino IDE 2.0.0. Ubuntu 22.04.3. I am trying to connect one esp8266 to another via my router.
My code is refusing to compile. The error message I get is: cannot declare variable 'webClient' to be of abstract type 'WiFiClient'. I have tried to compile other examples, copied from the net, that uses similar code code, but get the same result. This is my code:

#include <ESP8266WiFi.h>

const char* ssid = "----------";       // Your WiFi SSID
const char* password = "----------";   // Your WiFi password
const char* targetIP = "10.0.0.230";      // IP address of the second ESP8266
const int targetPort = 80;               // HTTP port

void setup() {
  Serial.begin(115200);

  WiFi.begin(ssid, password);

  Serial.print("Connecting to WiFi");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("\nConnected to WiFi");
}

void loop() {
  // Make sure the IP address of the second ESP8266 is correct
  if (WiFi.status() == WL_CONNECTED) {
    // Construct the URL
    String url = "/H";

    // Establish a connection with the server
    WiFiClient webClient;  // Change 'client' to 'webClient'
    if (webClient.connect(targetIP, targetPort)) {
      Serial.println("Connected to server");

      // Make the HTTP request
      webClient.print(String("GET ") + url + " HTTP/1.1\r\n" +
                      "Host: " + targetIP + "\r\n" +
                      "Connection: close\r\n\r\n");
      delay(10);

      // Read and print the response from the server
      while (webClient.available()) {
        String line = webClient.readStringUntil('\r');
        Serial.print(line);
      }
      Serial.println();
      
      webClient.stop();
    } else {
      Serial.println("Connection failed");
    }
  }
  
  delay(5000); // Wait for 5 seconds before sending the next request
}

I have tried various suggestions including reinstalling the 8266 boards in the board manager and changing the naming of "client" to "webclient". Any code that uses "WiFiClient client" seems to result in this error message on compilation. Haven't been able to find same problem on this forum.

Hi Rashid,
Welcome to the community!
I tried compiling with my ESP8266 board. I was able to compile it without any errors!
My board manager is version 3.1.2

Many thanks. I'll uninstall the IDE and reinstall then try again. :grinning:

Fresh install of Arduino IDE fixed the problem! Many thanks!