Problem with Multiple Libraries on Arduino 1.8.13

Hello, the answer to my question has been posted in many other formats and dialogues, but i still don't have my problem solved.
I am running this code below and an error saying that i have several libraries found for "SD.h" with the used and non-used libraries. I tried adding a library as the whole code zip file, nothing worked, i tried keeping only the libraries i want to use and deleting others, nothing worked. What exactly is the problem and what are some suggestions to fix it? Thank you so much for the help!
This is the code I'm using:

#include "Arduino.h"
#include <EMailSender.h>
#include <ESP8266WiFi.h>

//update your SSID and SSID password below
    const char* ssid = "SSID";
    const char* password = "SSID_PASSWORD";

    uint8_t connection_state = 0;
    uint16_t reconnect_interval = 10000;
    
    // update YOUR_GMAIL_ADDRESS and YOUR_PASSWORD below
    EMailSender emailSend("YOUR_GMAIL", "YOUR_PASSWORD");

uint8_t WiFiConnect(const char* nSSID = nullptr, const char* nPassword = nullptr)
{
    static uint16_t attempt = 0;
    Serial.print("Connecting to ");
    if(nSSID) {
        WiFi.begin(nSSID, nPassword);
        Serial.println(nSSID);
    }

    uint8_t i = 0;
    while(WiFi.status()!= WL_CONNECTED && i++ < 50)
    {
        delay(200);
        Serial.print(".");
    }
    ++attempt;
    Serial.println("");
    if(i == 51) {
        Serial.print("Connection: TIMEOUT on attempt: ");
        Serial.println(attempt);
        if(attempt % 2 == 0)
            Serial.println("Check if access point available or SSID and Password\r\n");
        return false;
    }
    Serial.println("Connection: ESTABLISHED");
    Serial.print("Got IP address: ");
    Serial.println(WiFi.localIP());
    return true;
}

void Awaits()
{
    uint32_t ts = millis();
    while(!connection_state)
    {
        delay(50);
        if(millis() > (ts + reconnect_interval) && !connection_state){
            connection_state = WiFiConnect();
            ts = millis();
        }
    }
}
int sensor_pin = A0; 
int output_value ;


void setup() {
  Serial.begin(115200);
  connection_state = WiFiConnect(ssid, password);
    if(!connection_state)  // if not connected to WIFI
        Awaits();          // constantly trying to connect
  Serial.println("Reading From the Sensor ...");
  delay(2000);
  }

void loop() {

  output_value= analogRead(sensor_pin);
  output_value = map(output_value,550,0,0,100);
  Serial.print("Moisture : ");
  Serial.print(output_value);
  Serial.println("%");
  EMailSender::EMailMessage message;
  String start = "Moisture Reading = ";
  String end = "%";
  message.subject = "Moisture Reading";
  String text4message = start + output_value + end;
  Serial.println(text4message);
  message.message = (text4message);
  
  //change YOUR_GMAIL_ADDRESS below
  EMailSender::Response resp = emailSend.send("YOUR_GMAIL", message);
  Serial.println("Sending status: ");
  Serial.println(resp.status);
  Serial.println(resp.code);
  Serial.println(resp.desc);
  delay(3600000); //wait 1 hour
  }```

Just a heads up, they'll likely ask you to auto-format your code in the IDE, edit the post and paste it inside code tags before they help you.

It makes it easier to see what's going on (or not).

Copy and paste the error message, most likely something else is causing the bugout thingy and the OP is missing it or not. Anyways post the error message so we can see what the error actually is; the whole message.

Thank you for that!!

Really? Why not just use a sleep mode?

Several libraries were found for "SD.h".
Used: C: \ Users \ Viola \ Documents \ ArduinoData \ packages \ esp8266 \ 2.4.2 \ libraries \ SD
Not used: C: \ Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.51.0_x86__mdggnx93n4wtt \ libraries \ SD
exit status 1
Error when compiling for the board NodeMCU 1.0 (ESP-12E module).

This is the original project code, i can edit it later, i don't think this has to do with the question about the error.

Are you certain that you have pasted the entire error message? You are sure you cannot go to the scroll bars and scroll up to see more of the error message?

That is just an informational message so whatever caused your compile to fail is in a different message.

In file included from C:\Users\Viola\Documents\Arduino\libraries\EMailSender/EMailSender.h:217:0,
from C:\Users\Viola\Downloads\2-email-capmoisturesensor\2-email-capmoisturesensor.ino:3:
C:\Users\Viola\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.2\libraries\SD\src/SD.h:26:7: error: redefinition of 'class fs::File'
class File : public Stream {
^
In file included from C:\Users\Viola\Documents\Arduino\libraries\EMailSender/EMailSender.h:205:0,
from C:\Users\Viola\Downloads\2-email-capmoisturesensor\2-email-capmoisturesensor.ino:3:
C:\Users\Viola\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.4.2\cores\esp8266/FS.h:48:7: error: previous definition of 'class fs::File'
class File : public Stream
^
Several libraries were found for "SD.h".
Used: C: \ Users \ Viola \ Documents \ ArduinoData \ packages \ esp8266 \ 2.4.2 \ libraries \ SD
Not used: C: \ Program Files\WindowsApps\ArduinoLLC.ArduinoIDE_1.8.51.0_x86__mdggnx93n4wtt \ libraries \ SD
exit status 1
Error when compiling for the board NodeMCU 1.0 (ESP-12E module).

If you comment out the EmailSender code and do a test recompile does the error show up?

Strange. It looks like the "FS.h" file in the ESP8266 core is conflicting with the built-in SD library in the ESP8266 core.

The latest ESP8266 support (V3.0.2) does not define File" in the SD library. That would eliminate the conflict. I suggest you go to Tools -> Board: -> Boards Manager... and update the ESP8266 support to the latest.

ARDUINO 1.8.15 2021.05.13
HOTFIX:

  • Fixed regression in library discovery (failing to compile bundled libs, like SD or Ethernet, on some platforms)
1 Like

Seems like I just had to keep on restarting and rebooting Arduino for it to work, weird but it did the job! Thank you all.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.