Teensy3 and SdFat.h

Status
Not open for further replies.

November

Member
Anyone have any ideas on why this code fails to compile. I cant tell if its my install or the code...

Code:
//#include <SD.h>
#include <SdFat.h>
//#include <Sd2Card.h>
//#include <SdVolume.h>
//#include <SdFile.h>

Sd2Card card;
SdVolume volume;
SdFile root;
SdFile file;

void setup() {
 Serial.begin(9600);
card.init(SPI_FULL_SPEED);
volume.init(&card);
root.openRoot(&volume);
}

void loop(){
 file.open(&root,"cat.txt",O_READ);
 int16_t n;
 uint8_t buf[7];
 
 while ((n = file.read(buf, sizeof(buf))) > 0){
  for (uint8_t i = 0; i < n; i++) Keyboard.print(buf[i]); 
 }
 
 file.close();
}

Errors:

In file included from /Users/November/Documents/Arduino/libraries/SdFat/SdFile.h:24,
from /Users/November/Documents/Arduino/libraries/SdFat/SdFat.h:35,
from sketch_dec12a.ino:2:
/Users/November/Documents/Arduino/libraries/SdFat/SdBaseFile.h:36: error: using typedef-name 'fpos_t' after 'struct'
/Applications/Arduino.app/Contents/Resources/Java/hardware/tools/arm-none-eabi/bin/../lib/gcc/arm-none-eabi/4.4.1/../../../../arm-none-eabi/include/stdio.h:59: error: 'fpos_t' has a previous declaration here
In file included from /Users/November/Documents/Arduino/libraries/SdFat/iostream.h:26,
from /Users/November/Documents/Arduino/libraries/SdFat/SdStream.h:27,
from /Users/November/Documents/Arduino/libraries/SdFat/SdFat.h:36,
from sketch_dec12a.ino:2:
/Users/November/Documents/Arduino/libraries/SdFat/istream.h:144: error: 'istream& istream::eek:perator>>(int16_t&)' cannot be overloaded
/Users/November/Documents/Arduino/libraries/SdFat/istream.h:126: error: with 'istream& istream::eek:perator>>(short int&)'
/Users/November/Documents/Arduino/libraries/SdFat/istream.h:153: error: 'istream& istream::eek:perator>>(uint16_t&)' cannot be overloaded
/Users/November/Documents/Arduino/libraries/SdFat/istream.h:135: error: with 'istream& istream::eek:perator>>(short unsigned int&)'
In file included from /Users/November/Documents/Arduino/libraries/SdFat/ArduinoStream.h:26,
from /Users/November/Documents/Arduino/libraries/SdFat/SdFat.h:37,
from sketch_dec12a.ino:2:
/Users/November/Documents/Arduino/libraries/SdFat/bufstream.h: In member function 'virtual void ibufstream::getpos(fpos_t*)':
/Users/November/Documents/Arduino/libraries/SdFat/bufstream.h:62: error: request for member 'position' in '* pos', which is of non-class type 'long int'
/Users/November/Documents/Arduino/libraries/SdFat/bufstream.h: In member function 'virtual void ibufstream::setpos(fpos_t*)':
/Users/November/Documents/Arduino/libraries/SdFat/bufstream.h:73: error: request for member 'position' in '* pos', which is of non-class type 'long int'


Sorry, I know its a long post -- just wanted to get it all out there.


Kind Regards,


November
 
Yes, this is the version I am compiling with.

Strange.. I compiled your code with the "non-beta" version of SDfat and I got the compilation errors you have. then I changed to the beta version referenced above and everything was fine.
Can you compile if you change the board type to Leonardo?
 
Strange.. I compiled your code with the "non-beta" version of SDfat and I got the compilation errors you have. then I changed to the beta version referenced above and everything was fine.
Can you compile if you change the board type to Leonardo?


Yes -- Can I download my code to the teensy 3 this way?
 
Yes -- Can I download my code to the teensy 3 this way?

I am running windows 7 64bit and it compiles fine with for Teensy 3. The reason I asked about lenoardo is the previous version of SDfat does compile for leonardo but not for teensy 3. can you try to download the library again and make sure you place in the correct folder.
 
Status
Not open for further replies.
Back
Top