Compiling issue when using the SD.h library #15
Description
Hi, i'm not really the most experienced arduino user, but while i was trying to write some sensor data to an external SD card with one of the new arduino Nano 33 BLE Sense boards, i've noticed that i'm not able to compile the SD.h library correctly when using the nRF528x core.
I'm always getting the following "expected unqualified-id before numeric constant in expansion of macro"-errors:
C:\Users\Voxcon\AppData\Local\Arduino15\packages\arduino\hardware\mbed\1.1.1\cores\arduino/mbed/platform/mbed_retarget.h:62:18: error: expected unqualified-id before numeric constant
#define O_RDONLY 0 ///< Open for reading
^
P:\Arduino\libraries\SD\src/utility/SdFat.h:55:15: note: in expansion of macro 'O_RDONLY'
uint8_t const O_RDONLY = O_READ;
^~~~~~~~
etc.
After some research i've figured out that the problem is that some of the macros (O_RDONLY, O_WRONLY, O_RDWR, O_ACCMODE, O_APPEND, O_CREAT, O_EXCL and O_TRUNC) defined in mbed_retarget.h are tried to be overwritten within the SdFat.h file, and because as far as i know macros can't easily be overwritten, this causes the compiliation errors. I'm not really sure where the macros defined in mbed_retarget.h are used within the current nRF528x core, but i would assume that the best way to solve this issue would be to simply not define the affected macros within that file or at all if they are defined by the SD.h library anyways. Alternatively we could update the SD.h library and comment out the overwriting statements for the macros within the SdFat.h file. I've tried this option and it works for me, but I'm not sure how this would affect the usability of the library for non-mbed based cores though.
It would be great if you could have a look at this.
Best regards,
Vox