mobizt / Firebase-ESP8266

[DEPRECATED] 🔥 Firebase RTDB Arduino Library for ESP8266 and RP2040 Pico. The complete, fast, secured and reliable Firebase Arduino client library that supports CRUD (create, read, update, delete) and Stream operations.
MIT License
411 stars 111 forks source link

Complie issue #323

Closed abh-shk closed 2 years ago

abh-shk commented 2 years ago

I am using ESP8266

as per instruction to avoid fingerprint issue i downloaded "Firebase-ESP8266-master" for which i am constantly getting error while compiling.

I am using

  1. ArduinoJson-5.x
  2. esp82666 boards installed 2.74

My Code below:

include

include

define FIREBASE_HOST "load*****.com" //Your Firebase Project URL goes here without "http:" , "\" and "/"

define FIREBASE_AUTH "NJ***mKb**" //Your Firebase Database Secret goes here

define WIFI_SSID "A***I" //your WiFi SSID for which yout NodeMCU connects

define WIFI_PASSWORD "Password123" //Password of your wifi network

// Declare the Firebase Data object in the global scope FirebaseData firebaseData;

// Declare global variable to store value int val=0;

void setup() {

Serial.begin(115200); // Select the same baud rate if you want to see the datas on Serial Monitor

Serial.println("Serial communication started\n\n");

WiFi.begin(WIFI_SSID, WIFI_PASSWORD); //try to connect with wifi Serial.print("Connecting to "); Serial.print(WIFI_SSID);

while (WiFi.status() != WL_CONNECTED) { Serial.print("."); delay(500); }

Serial.println(); Serial.print("Connected to "); Serial.println(WIFI_SSID); Serial.print("IP Address is : "); Serial.println(WiFi.localIP()); //print local IP address Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH); // connect to firebase

Firebase.reconnectWiFi(true); delay(1000); }

void loop() {

// Firebase Error Handling And Reading Data From Specified Path ****

if (Firebase.getInt(firebaseData, "/data")) { // On successful Read operation, function returns 1

if (firebaseData.dataType() == "int") {                            // print read data if it is integer

  val = firebaseData.intData();
  Serial.println(val);
  Serial.println("\n Change value at firebase console to see changes here."); 
  delay(10000);

}

} else { Serial.println(firebaseData.errorReason()); } }

While compiling below error is coming:

In file included from C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.cpp:42:0: C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:595:22: error: 'Client' has not been declared bool mReadClient(Client client); ^ In file included from C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.cpp:42:0: C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1151:18: error: 'Client' has not been declared int readLine(Client stream, char buf, int bufLen) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1175:18: error: 'Client' has not been declared int readLine(Client stream, MB_String &buf) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1199:25: error: 'Client' has not been declared int readChunkedData(Client stream, char out, int &chunkState, int &chunkedSize, int &dataLen, int bufLen) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1278:25: error: 'Client' has not been declared int readChunkedData(Client stream, MB_String &out, int &chunkState, int &chunkedSize, int &dataLen) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1352:20: error: 'Client' has not been declared int readClient(Client client, MB_String &buf) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h: In member function 'int FirebaseJsonBase::readLine(int, char, int)': C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1158:24: error: request for member 'available' in ' stream', which is of non-class type 'int' while (stream->available() && idx <= bufLen) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1162:27: error: request for member 'read' in ' stream', which is of non-class type 'int' res = stream->read(); ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h: In member function 'int FirebaseJsonBase::readLine(int, MB_String&)': C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1182:24: error: request for member 'available' in ' stream', which is of non-class type 'int' while (stream->available()) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1186:27: error: request for member 'read' in ' stream', which is of non-class type 'int' res = stream->read(); ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h: In member function 'int FirebaseJsonBase::readClient(int, MB_String&)': C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1366:36: error: request for member 'available' in ' client', which is of non-class type 'int' int chunkBufSize = client->available(); ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1376:24: error: request for member 'connected' in ' client', which is of non-class type 'int' while (client->connected() && chunkBufSize == 0 && millis() - dataTime < 5000) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1378:36: error: request for member 'available' in ' client', which is of non-class type 'int' chunkBufSize = client->available(); ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1382:21: error: request for member 'connected' in ' client', which is of non-class type 'int' if (client->connected()) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1393:44: error: request for member 'available' in ' client', which is of non-class type 'int' chunkBufSize = client->available(); ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1495:56: error: request for member 'available' in ' client', which is of non-class type 'int' while (client->available() > 0) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1496:53: error: request for member 'read' in ' client', which is of non-class type 'int' client->read(); ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1503:52: error: request for member 'available' in ' client', which is of non-class type 'int' while (client->available() > 0) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1504:49: error: request for member 'read' in ' client', which is of non-class type 'int' client->read(); ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1523:32: error: request for member 'available' in ' client', which is of non-class type 'int' while (client->available() > 0) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1524:29: error: request for member 'read' in ' client', which is of non-class type 'int' client->read(); ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h: At global scope: C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1832:19: error: 'Client' has not been declared bool readFrom(Client &client) { return mReadClient(&client); } ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:1834:19: error: 'Client' has not been declared bool readFrom(Client client) { return mReadClient(client); } ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.h:2285:19: error: 'Client' has not been declared bool readFrom(Client &client) { return mReadClient(&client); } ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.cpp:532:36: error: 'bool FirebaseJsonBase::mReadClient' is not a static member of 'class FirebaseJsonBase' bool FirebaseJsonBase::mReadClient(Client client) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.cpp:532:36: error: 'Client' was not declared in this scope C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.cpp:532:44: error: 'client' was not declared in this scope bool FirebaseJsonBase::mReadClient(Client client) ^ C:\Users\Dell\Documents\Arduino\libraries\Firebase-ESP8266-master\src\json\FirebaseJson.cpp:533:1: error: expected ',' or ';' before '{' token { ^ exit status 1 Error compiling for board NodeMCU 1.0 (ESP-12E Module).

Please help me to fix this issue.

mobizt commented 2 years ago

You need to update ESP8266 Arduino Core SDK. The latest version is recommended. The version less than 2.7.4 is not supported.

abh-shk commented 2 years ago

Thank you it really worked,

May i iknow if i can use latest ArduinoJason version also?

currently using v5.x

Lastest available v6.x

Kind Regards, Abdullah Shaikh

On Fri, 15 Apr 2022, 03:55 Suwatchai K., @.***> wrote:

You need to update ESP8266 Arduino Core SDK. The latest version is recommended. The version less than 2.7.4 is not supported.

— Reply to this email directly, view it on GitHub https://github.com/mobizt/Firebase-ESP8266/issues/323#issuecomment-1099726617, or unsubscribe https://github.com/notifications/unsubscribe-auth/AYXF5UV4OAVVOW72AQBRJXTVFCV6NANCNFSM5TPFTGAQ . You are receiving this because you authored the thread.Message ID: @.***>

mobizt commented 2 years ago

Nothing is related to that library.

The Firebase library has better built-in FirebaseJson.