Skip to content

Commit

Permalink
Add option to keep FS classes in namespace (#2030)
Browse files Browse the repository at this point in the history
Putting `#define FS_NO_GLOBALS` before `#include <FS.h>` will disable `using` declarations for FS classes.
  • Loading branch information
igrr committed May 16, 2016
1 parent 15aed3b commit 43fb139
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion cores/esp8266/FS.h
Expand Up @@ -127,6 +127,7 @@ class FS

} // namespace fs

#ifndef FS_NO_GLOBALS
using fs::FS;
using fs::File;
using fs::Dir;
Expand All @@ -135,7 +136,8 @@ using fs::SeekSet;
using fs::SeekCur;
using fs::SeekEnd;
using fs::FSInfo;
#endif //FS_NO_GLOBALS

extern FS SPIFFS;
extern fs::FS SPIFFS;

#endif //FS_H

1 comment on commit 43fb139

@Klaus66
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Ivan, all,
I'm new here and not a good programer...
I have a stable stand-alone ESP8266 webserver prorgammed with Arduino IDE running.
The webserver serves 3 pages from the internal SPIFFS (#include "FS.h").
All fine...
But now I'm trying to add an external SD- card module.
Hardware connection should be ok, as I'm able to run single SD card test ino with succsess.
However, as soon as I try to include (#include <SD.h>) to my webserver.ino, I got the following compiler error:

Multiple libraries were found for "SD.h"
Used: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\SD
Not used: C:\Arduino\arduino-1.6.12\libraries\SD
Using library ESP8266WiFi at version 1.0 in folder: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi
Using library ESP8266WebServer at version 1.0 in folder: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WebServer
Using library Wire at version 1.0 in folder: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\Wire
Using library SD at version 1.0.5 in folder: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\SD
Using library SPI at version 1.0 in folder: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\SPI
exit status 1
Error compiling for board NodeMCU 1.0 (ESP-12E Module).

I changed the FS.h according to the description above and added the define below as mentioned.
#define FS_NO_GLOBALSbefore#include <FS.h>
Then I got slightly different error messages:

Multiple libraries were found for "SD.h"
Used: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\SD
Not used: C:\Arduino\arduino-1.6.12\libraries\SD
Using library ESP8266WiFi at version 1.0 in folder: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi
Using library ESP8266WebServer at version 1.0 in folder: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WebServer
Using library Wire at version 1.0 in folder: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\Wire
Using library SD at version 1.0.5 in folder: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\SD
Using library SPI at version 1.0 in folder: C:\Arduino\arduino-1.6.12\portable\packages\esp8266\hardware\esp8266\2.3.0\libraries\SPI
exit status 1
no match for 'operator=' (operand types are 'File' and 'fs::File')

Looks like I have to call my files on internal SPIFFS somehow different. But how???

And what about the external SD card module?

Thanks in advance,
Klaus

Please sign in to comment.