Closed gregorysemah closed 2 years ago
I don't use the Teensy boards so cannot make specific recommendations, nor test my suggested solution or create examples.
If you are defining PREFER_SDFAT_LIBRARY
then you must make sure that the macro is set for all compilation units, including IniFile.cpp. I don't know if the Teensy has a way to set a macro in the build system that is external to the source files, if so you should use it. Unfortunately the standard @Arduino IDE does not, which has been a source of frustration to me*, exactly because of issues like this. Your simplest fix is probably to edit your local copy of IniFile.h and add the line
#define PREFER_SDFAT_LIBRARY
I realise that editing the code of an external library is not an acceptable solution but this is a common problem, one that Arduino need to resolve.
* I submitted a pull request to solve this problem 6 years ago, which was not accepted for philosophical reasons ("such external defines are considered harmful"), even though all other IDEs and build systems that I am familiar with support this feature. Many other people have requested similar features and others have submitted pull requests too. The Teensy core could make the FAT library an option in the board menu, the STM32 core does something similar to select which type of USB support is included. My energy to fight this battle has gone so to get that feature into my Calunium core in I added a build menu option which allows a custom sketch include file to be used.
I'm closing this because the changes to support your request belong outside of this library. Hopefully you have a better solution available than editing library headers.
It seems that it is possible to use SdFat (with teensy 4.1) But defining PREFER_SDFAT_LIBRARY seems not to work because of type of File Can you provide a simple example please?
thanks
Here the code I use, no instantiation for the moment, just #include