WiFiClient client fault

Arduino 1.8.9 D1 mini this error occurs during control cannot declare variable 'client' to be of abstract type 'WiFiClient'

marks this line as fault: WiFiClient client;

Please do this:

  • When you encounter an error, you’ll see a button on the right side of the orange bar “Copy error messages” in the Arduino IDE (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button…
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum’s code tags markup to your reply.
  • Press “Ctrl + V”. This will paste the error between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.

If the text exceeds the forum’s 9000 character limit, save it to a .txt file and post it as an attachment. If you click the “Reply” button here, you will see an “Attachments and other settings” link.

Please post your full sketch.

If possible, you should always post code directly in the forum thread as text using code tags:

  • Do an Auto Format (Tools > Auto Format[/b) on your code. This will make it easier for you to spot bugs and make it easier for us to read.[/li]
  • - Edit > Copy for Forum*
  • - In a forum reply here, click on the reply field.*
    - Click the </> button on the forum toolbar. This will add the forum’s code tags markup to your reply.
  • - Press “Ctrl + V”. This will paste the sketch between the code tags.*
  • - Move the cursor outside of the code tags before you add any additional text to your reply.*
  • - Repeat the above process if your sketch has multiple tabs.*
  • [/list]*
  • This will make it easy for anyone to look at it, which will increase the likelihood of you getting help.*
  • If the sketch is longer than the 9000 characters maximum allowed by the forum, then it’s OK to add it as an attachment. After clicking the “Reply” button, you will see an “Attachments and other settings” link.*
    When your code requires a library that’s not included with the Arduino IDE please post a link (using the chain links icon on the forum toolbar to make it clickable) to where you downloaded that library from or if you installed it using Library Manger (Sketch > Include Library > Manage Libraries in the Arduino IDE or Libraries > Library Manager in the Arduino Web Editor) then say so and state the full name of the library.

The code:

#include <WiFiClient.h>
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <BME280I2C.h>
#include <Arduino.h>

float temp, hum, pres;
BME280I2C bme;

String apiKey = "";
const char
ssid = "
";
const char
pass = "
***";
const char
server = “api.thingspeak.com”;
WiFiClient client;

void setup()
{
Serial.begin(9600);
Wire.begin();
while (!bme.begin())
{
Serial.println(“Could not find BME280 sensor!”);
delay(1000);
}

// bme.chipID(); // Deprecated. See chipModel().
switch (bme.chipModel())
{
case BME280::ChipModel_BME280:
Serial.println(“Found BME280 sensor! Success.”);
break;
case BME280::ChipModel_BMP280:
Serial.println(“Found BMP280 sensor! No Humidity available.”);
break;
default:
Serial.println(“Found UNKNOWN sensor! Error!”);
}

Serial.println();
Serial.println();
Serial.print(“Connecting to “);
Serial.println(ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(”.”);
}
Serial.println("");
Serial.println(“WiFi connected”);

}

void loop()
{

bme.read(pres, temp, hum);

if (client.connect(server, 80)) {
String postStr = apiKey;
postStr += “&field1=”;
postStr += String(temp);
postStr += “&field2=”;
postStr += String(hum);
postStr += “&field3=”;
postStr += String(((pres) / 100) + 11);

postStr += “\r\n\r\n”;

client.print(“POST /update HTTP/1.1\n”);
client.print(“Host: api.thingspeak.com\n”);
client.print(“Connection: close\n”);
client.print("X-THINGSPEAKAPIKEY: " + apiKey + “\n”);
client.print(“Content-Type: application/x-www-form-urlencoded\n”);
client.print(“Content-Length: “);
client.print(postStr.length());
client.print(”\n\n”);
client.print(postStr);

Serial.println();

Serial.print(“BME280 hofok: “);
Serial.print(temp);
Serial.println(” C”);
Serial.print(“BME280 paratartalom: “);
Serial.print(hum);
Serial.println(” Rh%”);
Serial.print(“BME280 legnyomas: “);
Serial.print(((pres) / 100) + 11);
Serial.println(” hPa”);
Serial.println(" - Adatok elkuldve Thingspeak-re-");
}
client.stop();

Serial.println(“Uj adat kuldese 1 perc mulva”);
// thingspeak needs at least a 15 sec delay between updates
// 20 seconds to be safe

delay(60000);

error messages:
Arduino: 1.8.9 (Windows 10), Alaplap:“LOLIN(WEMOS) D1 R2 & mini, 80 MHz, Flash, Disabled, 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200”

In file included from G:\arduino\bme280lhho_thing_wemos_gyakorlas\bme280lhho_thing_wemos_gyakorlas.ino:2:0:

G:\arduino\libraries\ESP8266WiFi\src/WiFiClient.h:56:15: error: ‘virtual int WiFiClient::connect(IPAddress, uint16_t)’ marked override, but does not override

virtual int connect(IPAddress ip, uint16_t port) override;

^

G:\arduino\libraries\ESP8266WiFi\src/WiFiClient.h:76:16: error: ‘virtual void WiFiClient::stop()’ marked override, but does not override

virtual void stop() override { (void)stop(0); }

^

In file included from G:\arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:40:0,

from G:\arduino\bme280lhho_thing_wemos_gyakorlas\bme280lhho_thing_wemos_gyakorlas.ino:3:

G:\arduino\libraries\ESP8266WiFi\src/WiFiServer.h:52:14: error: invalid abstract return type for member function ‘WiFiClient WiFiServer::available(uint8_t*)’

WiFiClient available(uint8_t* status = NULL);

^

In file included from G:\arduino\bme280lhho_thing_wemos_gyakorlas\bme280lhho_thing_wemos_gyakorlas.ino:2:0:

G:\arduino\libraries\ESP8266WiFi\src/WiFiClient.h:45:7: note: because the following virtual functions are pure within ‘WiFiClient’:

class WiFiClient : public Client, public SList {

^

In file included from G:\arduino\libraries\ESP8266WiFi\src/WiFiClient.h:27:0,

from G:\arduino\bme280lhho_thing_wemos_gyakorlas\bme280lhho_thing_wemos_gyakorlas.ino:2:

C:\Users\Zoltan\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/Client.h:29:21: note: virtual int Client::connect(const IPAddress&, uint16_t)

virtual int connect(CONST IPAddress& ip, uint16_t port) =0;

^

In file included from G:\arduino\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:29:0,

from G:\arduino\libraries\ESP8266WiFi\src/WiFiClientSecure.h:41,

from G:\arduino\libraries\ESP8266WiFi\src/WiFiServerSecure.h:20,

from G:\arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:41,

from G:\arduino\bme280lhho_thing_wemos_gyakorlas\bme280lhho_thing_wemos_gyakorlas.ino:3:

G:\arduino\libraries\ESP8266WiFi\src/BearSSLHelpers.h:148:34: error: ‘virtual const unsigned char* BearSSL::HashSHA256::oid()’ marked override, but does not override

virtual const unsigned char *oid() override;

^

In file included from G:\arduino\libraries\ESP8266WiFi\src/WiFiClientSecure.h:41:0,

from G:\arduino\libraries\ESP8266WiFi\src/WiFiServerSecure.h:20,

from G:\arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:41,

from G:\arduino\bme280lhho_thing_wemos_gyakorlas\bme280lhho_thing_wemos_gyakorlas.ino:3:

G:\arduino\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h: In member function ‘int BearSSL::WiFiClientSecure::getMFLNStatus()’:

G:\arduino\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:112:67: error: ‘br_ssl_engine_get_mfln_negotiated’ was not declared in this scope

return connected() && br_ssl_engine_get_mfln_negotiated(_eng);

^

In file included from G:\arduino\libraries\ESP8266WiFi\src/WiFiServerSecure.h:23:0,

from G:\arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:41,

from G:\arduino\bme280lhho_thing_wemos_gyakorlas\bme280lhho_thing_wemos_gyakorlas.ino:3:

G:\arduino\libraries\ESP8266WiFi\src/WiFiServerSecureBearSSL.h: At global scope:

G:\arduino\libraries\ESP8266WiFi\src/WiFiServerSecureBearSSL.h:59:22: error: invalid abstract return type for member function ‘BearSSL::WiFiClientSecure BearSSL::WiFiServerSecure::available(uint8_t*)’

WiFiClientSecure available(uint8_t* status = NULL);

^

In file included from G:\arduino\libraries\ESP8266WiFi\src/WiFiClientSecure.h:41:0,

from G:\arduino\libraries\ESP8266WiFi\src/WiFiServerSecure.h:20,

from G:\arduino\libraries\ESP8266WiFi\src/ESP8266WiFi.h:41,

from G:\arduino\bme280lhho_thing_wemos_gyakorlas\bme280lhho_thing_wemos_gyakorlas.ino:3:

G:\arduino\libraries\ESP8266WiFi\src/WiFiClientSecureBearSSL.h:34:7: note: because the following virtual functions are pure within ‘BearSSL::WiFiClientSecure’:

class WiFiClientSecure : public WiFiClient {

^

In file included from G:\arduino\libraries\ESP8266WiFi\src/WiFiClient.h:27:0,

from G:\arduino\bme280lhho_thing_wemos_gyakorlas\bme280lhho_thing_wemos_gyakorlas.ino:2:

C:\Users\Zolt�n\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.5.0\cores\esp8266/Client.h:29:21: note: virtual int Client::connect(const IPAddress&, uint16_t)

virtual int connect(CONST IPAddress& ip, uint16_t port) =0;

^

bme280lhho_thing_wemos_gyakorlas:26:12: error: cannot declare variable ‘client’ to be of abstract type ‘WiFiClient’

WiFiClient client;

^

In file included from G:\arduino\bme280lhho_thing_wemos_gyakorlas\bme280lhho_thing_wemos_gyakorlas.ino:2:0:

G:\arduino\libraries\ESP8266WiFi\src/WiFiClient.h:45:7: note: since type ‘WiFiClient’ has pure virtual functions

class WiFiClient : public Client, public SList {

exit status 1
cannot declare variable ‘client’ to be of abstract type ‘WiFiClient’

gpzzoli:
G:\arduino\libraries\ESP8266WiFi\src/WiFiClient.h:45:7: note: because the following virtual functions are pure within ‘WiFiClient’:

class WiFiClient : public Client, public SList {

^

The problem is that your ESP8266WiFi library doesn’t match with your ESP8266 core. This is because for some inexplicable reason you installed the ESP8266WiFi library separate from the ESP8266 core. The ESP8266 core comes with a version of the ESP8266WiFi library bundled. The library version and the core version are specifically matched. So don’t every install the ESP8266WiFi library separately unless you are specifically doing beta testing or development for the ESP8266 core and know exactly what you’re doing. Besides, it must have been quite a process even managing to install that library, since it’s part of the esp8266 repository.

So just delete G:\arduino\libraries\ESP8266WiFi and the problem will be solved. Please be very careful when deleting things on your computer. When in doubt, back up!

I did it.. it's working fine.... thanks so much.

The programme has been showing the status of the upload in a percentage form so far. Now it has disappeared

You're welcome. I'm glad to hear it's working now. Enjoy! Per