I'm trying to get an SD card reader interfaced with a NodeMCU, and am running into difficulties.
I tried the "QuickStart" example in the "ESP8266SdFat" example set. I got this error message when I tried to compile.
QuickStart:7:17: error: 'sdfat' is not a namespace-name
using namespace sdfat;
Commenting out the "using namespace" statement allowed the code to compile and it ran fine. But needing to modify off-the-shelf examples rings an alarm bell for me.
I added the line "#include <ESP8266WiFi.h>" to the modified QuickStart example (I need this to include Blynk functionality in my sketch). I got the errors:
In file included from /Users/Me/Arduino/code/libraries/SdFat_-_Adafruit_Fork/src/FatLib/FatLib.h:27:0,
from /Users/Me/Arduino/code/libraries/SdFat_-_Adafruit_Fork/src/SdFat.h:33,
from /var/folders/v6/4c56t8sx2qg2mfs51jhrdksw0000gp/T/arduino_modified_sketch_398369/QuickStart.ino:6:
/Users/MeArduino/code/libraries/SdFat_-_Adafruit_Fork/src/FatLib/ArduinoFiles.h:122:7: error: redefinition of 'class fs::File'
class File : public FatFile, public Stream {
^
followed by:
Multiple libraries were found for "SdFat.h"
Used: /Users/Me/Arduino/code/libraries/SdFat_-_Adafruit_Fork
Not used: /Users/Me/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/ESP8266SdFat
I understand what the "Multiple libraries" is telling me, but I'm not sure how to properly resolve it in a way that will allow my NodeMCU sketches to run, and also allow me to continue AVR development using SdFat. Any suggestions? Thanks!
With the Arduino IDE, in case of "multiple libraries" error, you can't choose which library to use, so you have to uninstall SdFat_-_Adafruit_Fork.
You would not have this problem with a more advanced IDE such as VS Code with PlatformIO, where you can choose exactly which library to use in the current project
guix: I need to use SdFat with AVR boards. If I take your suggestion, I won't be able to do that, so I need a more complete approach.
cattledog: I tried your approach of renaming the esp8266 SdFat library. When I do that I get a whole series of compiler errors ending with:
Using library ESP8266WiFi at version 1.0 in folder: /Users/Me/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/ESP8266WiFi
Using library SPI at version 1.0 in folder: /Users/Me/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/SPI
Using library SdFat at version 1.1.0 in folder: /Users/Me/Library/Arduino15/packages/esp8266/hardware/esp8266/2.7.4/libraries/SdFat
exit status 1
'SdFat' does not name a type
Is there something more or different I need to do to replicate your success?
I can't confirm what you see. Can you explain more about your environment.
With folder esp8266SdFat renamed to SdFat in the libraries folder of the 2.7.4 core I can successfully compile "Quick Start" example.
In the compiler output I show:
Multiple libraries were found for "SdFat.h"
Used: C:\Users\me\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\SdFat
Not used: C:\Users\me\Documents\Arduino\libraries\SdFat
Using library SdFat at version 2.0.2 in folder: C:\Users\me\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.7.4\libraries\SdFat
My bad. I was using the wrong version of "QuickStart" When I switched to the example from esp8266, everything compiled fine, even after I added the ESP8266WiFi.h include! Thanks very much for your help, cattledog