Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 5 of 5

Thread: Compile Error: SdFat_Usage.ino - Starting with TD1.57B1 up to TD1.57B3

  1. #1
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    744

    Compile Error: SdFat_Usage.ino - Starting with TD1.57B1 up to TD1.57B3

    Was testing SdFat_Usage to see how to use the SdFat bytesPerSector() function and received this compile error:

    Code:
    SdFat_Usage: In function 'void setup()':
    SdFat_Usage:122: error: call of overloaded 'write(char)' is ambiguous
       myfile.write('\0'); // add a null byte to mark end of string
                        ^
    In file included from /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SdFat/src/ExFatLib/ExFatFile.h:821:0,
                     from /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SdFat/src/ExFatLib/ExFatVolume.h:27,
                     from /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SdFat/src/ExFatLib/ExFatLib.h:27,
                     from /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SdFat/src/SdFat.h:35,
                     from /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SD/src/SD.h:27,
                     from /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SD/examples/SdFat_Usage/SdFat_Usage.ino:18:
    /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SdFat/src/ExFatLib/../common/ArduinoFiles.h:140:10: note: candidate: size_t StreamFile<BaseFile, PosType>::write(uint8_t) [with BaseFile = FsBaseFile; PosType = long long unsigned int; size_t = unsigned int; uint8_t = unsigned char]
       size_t write(uint8_t b) {
              ^
    In file included from /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SdFat/src/FsLib/FsLib.h:32:0,
                     from /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SdFat/src/SdFat.h:37,
                     from /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SD/src/SD.h:27,
                     from /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SD/examples/SdFat_Usage/SdFat_Usage.ino:18:
    /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SdFat/src/FsLib/FsFile.h:761:10: note: candidate: size_t FsBaseFile::write(const char*)
       size_t write(const char* str) {
              ^
    Multiple libraries were found for "SD.h"
     Used: /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SD
     Not used: /home/wwatson/arduino-1.8.19.org2/libraries/SD
    Using library SD at version 2.0.0 in folder: /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SD 
    Using library SdFat at version 2.1.2 in folder: /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SdFat 
    Using library SPI at version 1.0 in folder: /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SPI 
    call of overloaded 'write(char)' is ambiguous
    Went back to TD1.56 release and the sketch compiled without error.
    Tested with clean install of Arduino 1.8.19 and TD1.57B1 to 1.57B3 Ubuntu 20.04.

    Has anybody else run into this?

  2. #2
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,975
    With the SDFat stuff, I know Paul has pulled in more recent version of Bill's stuff. He also removed some of the stuff we had added as to limit how many changes are needed for our stuff to work.

    We have pulled in some of the stuff into other places, like the format code into USBHost...

    Plus we had to replicate a function or two like that...

    So yes the SD example does not built... Will take a look

  3. #3
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    744
    @KurtE - Thanks. I know there were changes. Just wanted to make sure

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,975
    Although the fix to build was to change line 122 in the example
    From:
    Code:
      myfile.write('\0'); // add a null byte to mark end of string
    To:
    Code:
     myfile.write((uint8_t)'\0'); // add a null byte to mark end of string
    Not sure yet why the cast is needed now and not before... Wonder what changed in SDFat...

  5. #5
    Senior Member wwatson's Avatar
    Join Date
    Aug 2017
    Posts
    744
    Quote Originally Posted by KurtE View Post
    Although the fix to build was to change line 122 in the example
    From:
    Code:
      myfile.write('\0'); // add a null byte to mark end of string
    To:
    Code:
     myfile.write((uint8_t)'\0'); // add a null byte to mark end of string
    Not sure yet why the cast is needed now and not before... Wonder what changed in SDFat...
    Your right the cast allows it to compile clean...

    It will also compile and work with this:
    Code:
      myfile.write(""); // add a null byte to mark end of string
    Or:
    Code:
      myfile.print("Just some test data written to the file (by SdFat functions)\0");
    Possibly a conflict between:
    Code:
    /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SdFat/src/ExFatLib/../common/ArduinoFiles.h:140:10: note: candidate: size_t StreamFile<BaseFile, PosType>::write(uint8_t) [with BaseFile = FsBaseFile; PosType = long long unsigned int; size_t = unsigned int; uint8_t = unsigned char]
       size_t write(uint8_t b) {
    and:
    Code:
    /home/wwatson/arduino-1.8.19.org2/hardware/teensy/avr/libraries/SdFat/src/FsLib/FsFile.h:761:10: note: candidate: size_t FsBaseFile::write(const char*)
       size_t write(const char* str) {

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •