No matching function for call to 'FirebaseESP32::begin(const char [31], const char [13])'

Hello experts,
I am using Arduion online editor and trying to compile code for ESP32 + Firebase, but I got error: no matching function for call to 'FirebaseESP32::begin(const char [31], const char [13])'
however, same code is working fine on Arduino local software, what's the reason ?
Please let me know

#include <FirebaseESP32.h>
#include <WiFi.h>

#define FIREBASE_HOST "your_project_id.firebaseio.com"
#define FIREBASE_AUTH "your_api_key"

FirebaseData firebaseData;

void setup() {
  Serial.begin(115200);
  WiFi.begin("your_wifi_ssid", "your_wifi_password");

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

  Serial.println("Connected to WiFi!");
  Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
}

void loop() {
  // Sample variable data to be sent
  int sensorValue = analogRead(A0);

  // Construct the data to be sent in JSON format
  String dataToSend = "{\"sensor_value\": " + String(sensorValue) + "}";

  // Send data to Firebase
  Firebase.updateNode(firebaseData, "/sensors/sensor1", dataToSend);

  delay(5000); // Adjust the interval based on your requirements
}

[sterretje]Code tags adjusted

I've seen your attempt at code tags. It's three consecutive backticks (```) with no spaces in between them.

Can't help you with your question

From a quick glance at some Firebase examples, it seems that the begin method needs pointers to a FirebaseAuth variable and a FirebaseConfig variable, not the host and auth strings. They get put into fields in the FirebaseConfig variable, like so:

FirebaseAuth auth;
FirebaseConfig config;
.
.
.
config.api_key = FIREBASE_AUTH;
config.database_url = FIREBASE_HOST;
.
.
.
Firebase.begin(&config, &auth);

and there seems to be a call to Firebase.signup before you can call Firebase.begin.

Take all that with a grain of salt, if not a whole salt lick. It's just the initial observations of someone who knows nothing about Firebase after 2 minutes of Googling.

1 Like

thanks for your valuable remarks, actually the issue is why the same is compiled successfully at offline Arduino IDE but error occurs while compiling with online editor?

Different versions of the board package or library?

If you want to analyse board package

  1. Make a note which board package is currently installed in the offline IDE.
  2. Repeat for the online IDE.
  3. Install the same version in the offline IDE as is installed in the online IDE.
  4. Test

You should always be able to roll the board package in the offline IDE back.

You can repeat the steps for the library (replace board package by library in above).

Surely that's obvious; the relevant libraries in the local IDE and the online editor are different versions, or even from different sources.

I have the same problem as you, how did you solve it?

The original author most likely simply had the incorrect code.
If you have "the same problem", then you need to fix the errors in the sketch

#include <FirebaseESP32.h>
#include <WiFi.h>
#include <DHT.h> // Install DHT11 Library and Adafruit Unified Sensor Library

#define FIREBASE_HOST "YOUR_FIREBASE_PROJECT.firebaseio.com" //Without http:// or https:// schemes
#define FIREBASE_AUTH "YOUR_FIREBASE_DATABASE_SECRET"
#define WIFI_SSID "TP-LINK_4206DF"
#define WIFI_PASSWORD "20172018"

#define DHTPIN 2 // Connect Data pin of DHT to D2
int led = 5; // Connect LED to D5

#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);

//Define FirebaseESP8266 data object
FirebaseData firebaseData;
FirebaseData ledData;

FirebaseJson json;

void setup()
{

Serial.begin(9600);

dht.begin();
pinMode(led,OUTPUT);

WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to Wi-Fi");
while (WiFi.status() != WL_CONNECTED)
{
Serial.print(".");
delay(300);
}
Serial.println();
Serial.print("Connected with IP: ");
Serial.println(WiFi.localIP());
Serial.println();

Firkebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
Firebase.reconnectWiFi(true);

}

void sensorUpdate(){
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float h = dht.readHumidity();
// Read temperature as Celsius (the default)
float t = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
float f = dht.readTemperature(true);

// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
}

Serial.print(F("Humidity: "));
Serial.print(h);
Serial.print(F("% Temperature: "));
Serial.print(t);
Serial.print(F("°C ,"));
Serial.print(f);
Serial.println(F("°F "));

if (Firebase.setFloat(firebaseData, "/esp/temperature", t))
{
Serial.println("PASSED");
Serial.println("PATH: " + firebaseData.dataPath());
Serial.println("TYPE: " + firebaseData.dataType());
Serial.println("ETag: " + firebaseData.ETag());
Serial.println("------------------------------------");
Serial.println();
}
else
{
Serial.println("FAILED");
Serial.println("REASON: " + firebaseData.errorReason());
Serial.println("------------------------------------");
Serial.println();
}

if (Firebase.setFloat(firebaseData, "/esp/humidity", h))
{
Serial.println("PASSED");
Serial.println("PATH: " + firebaseData.dataPath());
Serial.println("TYPE: " + firebaseData.dataType());
Serial.println("ETag: " + firebaseData.ETag());
Serial.println("------------------------------------");
Serial.println();
}
else
{
Serial.println("FAILED");
Serial.println("REASON: " + firebaseData.errorReason());
Serial.println("------------------------------------");
Serial.println();
}
}
void loop() {
sensorUpdate();

if (Firebase.getString(ledData, "/esp/led")){
Serial.println(ledData.stringData());
if (ledData.stringData() == "1") {
digitalWrite(led, HIGH);
}
else if (ledData.stringData() == "0"){
digitalWrite(led, LOW);
}
}
delay(100);
}

this my sketch and I got this error can you help me solve it

Compilation error: no matching function for call to 'FirebaseESP32::begin(const char [35], const char [41])'
C:\Users\IMAD\AppData\Local\Temp.arduinoIDE-unsaved2024231-8500-179no91.a8o9\sketch_mar31a\sketch_mar31a.ino: In function 'void setup()':
C:\Users\IMAD\AppData\Local\Temp.arduinoIDE-unsaved2024231-8500-179no91.a8o9\sketch_mar31a\sketch_mar31a.ino:42:46: error: no matching function for call to 'FirebaseESP32::begin(const char [35], const char [41])'
Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
^
In file included from c:\Users\IMAD\Documents\Arduino\libraries\Firebase_ESP32_Client\src/FirebaseESP32.h:42,
from C:\Users\IMAD\AppData\Local\Temp.arduinoIDE-unsaved2024231-8500-179no91.a8o9\sketch_mar31a\sketch_mar31a.ino:3:
c:\Users\IMAD\Documents\Arduino\libraries\Firebase_ESP32_Client\src/Firebase.h:130:8: note: candidate: 'void FirebaseESP32::begin(FirebaseConfig*, FirebaseAuth*)'
void begin(FirebaseConfig config, FirebaseAuth auth);
^~~~~
c:\Users\IMAD\Documents\Arduino\libraries\Firebase_ESP32_Client\src/Firebase.h:130:8: note: no known conversion for argument 1 from 'const char [35]' to 'FirebaseConfig
' {aka 'firebase_cfg_t
'}
C:\Users\IMAD\AppData\Local\Temp.arduinoIDE-unsaved2024231-8500-179no91.a8o9\sketch_mar31a\sketch_mar31a.ino: In function 'void loop()':
C:\Users\IMAD\AppData\Local\Temp.arduinoIDE-unsaved2024231-8500-179no91.a8o9\sketch_mar31a\sketch_mar31a.ino:116:13: error: expected '}' at end of input
delay(100);
^
C:\Users\IMAD\AppData\Local\Temp.arduinoIDE-unsaved2024231-8500-179no91.a8o9\sketch_mar31a\sketch_mar31a.ino:104:13: note: to match this '{'
void loop() {
^
Multiple libraries were found for "SD.h"
Used: C:\Users\IMAD\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.14\libraries\SD
Not used: C:\Users\IMAD\AppData\Local\Arduino15\libraries\SD
exit status 1

Compilation error: no matching function for call to 'FirebaseESP32::begin(const char [35], const char [41])'

See the answer #3 - the line

is incorrect or outdate.

Looks like @madesp32 has a thread here with the same question.