I haven't used this Data Logger shield before, and cant get past this problem compiling. I am running Arduino v18 on Mac. The message reads: /Users/BANNED/Documents/Arduino/libraries/SD/SD.h:26: error: expected class-name before '{' token
I am using the CardInfo example sketch.I don't know where to begin since it seems to be indicating a problem with the library, which was downloaded and installed as described in the tutorial.
I have started looking at the SD.h file to see if anything stands out ( see the line with arrow beside below <-------- )
---------------------------------------------------------------------------
/*
SD - a slightly more friendly wrapper for sdfatlib
This library aims to expose a subset of SD card functionality
in the form of a higher level "wrapper" object.
License: GNU General Public License V3
(Because sdfatlib is licensed with this.)
(C) Copyright 2010 SparkFun Electronics
*/
#ifndef __SD_H__
#define __SD_H__
#include <WProgram.h>
#include <utility/SdFat.h>
#include <utility/SdFatUtil.h>
#define FILE_READ O_READ
#define FILE_WRITE (O_READ | O_WRITE | O_CREAT)
class File : public Stream { <------------------------------------------------------------------------
private:
char _name[13]; // our name
SdFile *_file; // underlying file pointer
public:
File(SdFile f, char *name); // wraps an underlying SdFile
File(void); // 'empty' constructor
~File(void); // destructor
virtual void write(uint8_t);
virtual void write(const char *str);
virtual void write(const uint8_t *buf, size_t size);
virtual int read();
virtual int peek();
virtual int available();
virtual void flush();
int read(void *buf, uint16_t nbyte);
boolean seek(uint32_t pos);
uint32_t position();
uint32_t size();
void close();
operator bool();
char * name();
boolean isDirectory(void);
File openNextFile(uint8_t mode = O_RDONLY);
void rewindDirectory(void);
};
class SDClass {
private:
// These are required for initialisation and use of sdfatlib
Sd2Card card;
SdVolume volume;
SdFile root;
// my quick&dirty iterator, should be replaced
SdFile getParentDir(char *filepath, int *indx);
public:
// This needs to be called to set up the connection to the SD card
// before other methods are used.
boolean begin(uint8_t csPin = SD_CHIP_SELECT_PIN);
// Open the specified file/directory with the supplied mode (e.g. read or
// write, etc). Returns a File object for interacting with the file.
// Note that currently only one file can be open at a time.
File open(char *filename, uint8_t mode = FILE_READ);
// Methods to determine if the requested file path exists.
boolean exists(char *filepath);
// Create the requested directory heirarchy--if intermediate directories
// do not exist they will be created.
boolean mkdir(char *filepath);
// Delete the file.
boolean remove(char *filepath);
boolean rmdir(char *filepath);
private:
// This is used to determine the mode used to open a file
// it's here because it's the easiest place to pass the
// information through the directory walking function. But
// it's probably not the best place for it.
// It shouldn't be set directly--it is set via the parameters to `open`.
int fileOpenMode;
friend class File;
friend boolean callback_openPath(SdFile&, char *, boolean, void *);
};
extern SDClass SD;
#endif
-----------------------------------------------------------------------------------
any ideas?
Thanks!
Error compiling Data Logger CardInfo
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: Error compiling Data Logger CardInfo
Try arduino 22, so at least that isnt in question!
- fat16lib
- Posts: 595
- Joined: Wed Dec 24, 2008 1:54 pm
Re: Error compiling Data Logger CardInfo
SD.h requires a version of the IDE with the Stream class. 0018 does not support Stream. You must update your IDE to use SD.h.
- acastronovo
- Posts: 12
- Joined: Sun Aug 17, 2008 10:18 am
Re: Error compiling Data Logger CardInfo
Thanks, upgraded to v22 and it works perfectly!
Thank you!
Thank you!
Please be positive and constructive with your questions and comments.