-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working when using SdFat instead of SD library #38
Comments
I've not used the SdFat library - the changes to support it have been contributed from users. I cannot confirm that the examples will work with it (I hope they do but I have never tried them that way). You'll need to make sure that the If you define A real IDE will allow you to define a macro globally that is applied for all compilation units. For some stupid ideological reasons the Arduino developers think this is not necessary. I've lost count of the number of times these type of problems have arisen because of this. I even submitted a PR (arduino/arduino-builder#29) to fix it but it has not been accepted. |
Hi Thanks for your answer. I'm not an experienced developer and I don't fully understand your proposal. I cannot understand how editting the IniFile.h and including the PREFER_SDFAT_LIBRARY macro there this would be solved. As far as I can understand the code, the SD and SdFat classes should be managed the same by IniFile. The PREFER_SDFAT_LIBRARY only affects which one is loaded, but the IniFile constructor is not affected by the macro, right? Just to make you aware, my interest in using SdFat instead of SD is because I've read that SdFat makes a better energy management of the SD hardware, and I'm trying to minimize power consumption on a project. Thanks again |
You define |
Hi! You are a genius :) I've finally got it working after following your instructions but I had some problems I would like to share with you: your solution works only if "IniFile.h" and "IniFile.cpp" are on the same directory as my .ino files. I've also tried to create a subfolder "Lib" in my project, just to keep things in order, and I've placed the .h and .cpp files there properly referenced from my .ino file and that keeps yelling the same error. Is that "subfolder inclusion" not working for any other reason? Can you explain me why? I think I would learn something else from you :) Thanks! |
Hi!
Thanks for your work on this library!
I've been trying to use IniFile compining against SdFat instead the defaukt SD library. I've used the examples included in IniFile witout success.
`#include <SD.h>
#include <SPI.h>
#include <IPAddress.h>
#include <IniFile.h>
// The select pin used for the SD card
[...]`
`#define PREFER_SDFAT_LIBRARY 1
#include <SdFat.h>
#include <SPI.h>
#include <IPAddress.h>
#include <IniFile.h>
// The select pin used for the SD card
[...]`
Error:
tmp/arduino/sketches/BB2A6256ECD89697A9217989C990A171/sketch/IniBrowseExample.ino.cpp.o: In function
IniFile::open()':/home/user/Arduino/libraries/IniFile/src/IniFile.h:161: undefined reference to
SD' /tmp/arduino/sketches/BB2A6256ECD89697A9217989C990A171/sketch/IniBrowseExample.ino.cpp.o: In function
setup':/tmp/.arduinoIDE-unsaved202339-2452-1rlkvoh.nh7h/IniBrowseExample/IniBrowseExample.ino:72: undefined reference to
IniFile::IniFile(char const*, int, bool)' /tmp/.arduinoIDE-unsaved202339-2452-1rlkvoh.nh7h/IniBrowseExample/IniBrowseExample.ino:126: undefined reference to
SD'/tmp/.arduinoIDE-unsaved202339-2452-1rlkvoh.nh7h/IniBrowseExample/IniBrowseExample.ino:126: undefined reference to `SD'
collect2: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1`
`#define PREFER_SDFAT_LIBRARY 1
#include <SdFat.h>
SdFat SD;
#include <SPI.h>
#include <IPAddress.h>
#include <IniFile.h>
// The select pin used for the SD card
[...]`
Error:
/tmp/arduino/sketches/BB2A6256ECD89697A9217989C990A171/sketch/IniBrowseExample.ino.cpp.o: In function
setup':/tmp/.arduinoIDE-unsaved202339-2452-1rlkvoh.nh7h/IniBrowseExample/IniBrowseExample.ino:73: undefined reference to `IniFile::IniFile(char const*, int, bool)'
collect2: error: ld returned 1 exit status
exit status 1
Compilation error: exit status 1`
Is there any way to solve this? If I can help any way please let me know.
Thanks!
The text was updated successfully, but these errors were encountered: