Problem in declaration

Hello people, i got an error when i compile my codings in arduino IDE saying that the declaration of a text file is wrong, I have added the sdFAT library but still i coudnt declare the Test file with the variable FAT. Can anyone help me to declare,

My coding is,

#include <SoftwareSerial.h>
#include <byteordering.h>
#include <fat.h>
#include <FAT16.h>
#include <fat_config.h>
#include <partition.h>
#include <partition_config.h>
#include <sd-reader_config.h>
#include <sd_raw.h>
#include <sd_raw_config.h>

byte incomingbyte;
SoftwareSerial cameraSerial= SoftwareSerial(4,5); // Set Arduino pin 4 and 5 as softserial
long int a=0x0000,j=0,k=0,count=0,i=0;
uint8_t MH,ML;
boolean EndFlag=0;
FAT TestFile; //This is the place i get error

void SendResetCmd();
void SetBaudRateCmd();
void SetImageSizeCmd();
void SendTakePhotoCmd();
void SendReadDataCmd();
void StopTakePhotoCmd();

void setup()
{
boolean sd_raw_init();
Serial.begin(38400);
cameraSerial.begin(38400);
pinMode(2,OUTPUT); //pin 2 is connected to LED to indicate the status of SD card initialization

if(!sd_raw_init())
{
digitalWrite(2,HIGH);
while(1);
}
TestFile.initialize();
TestFile.create_file("xiaohui.jpg"); // create a new jpeg file

}

void loop()
{
byte a[32];

SendResetCmd();
delay(4000); //Wait 2-3 second to send take picture command

SendTakePhotoCmd();

while(cameraSerial.available()>0)
{
incomingbyte=cameraSerial.read();
}

TestFile.open();
while(!EndFlag)
{
j=0;
k=0;
count=0;
SendReadDataCmd();
delay(20);
while(cameraSerial.available()>0)
{
incomingbyte=cameraSerial.read();
k++;
if((k>5)&&(j<32)&&(!EndFlag))
{
a[j]=incomingbyte;
if((a[j-1]==0xFF)&&(a[j]==0xD9)) //tell if the picture is finished
EndFlag=1;
j++;
count++;
}
}

for(j=0;j<count;j++)
{ if(a[j]<0x10)
Serial.print("0");
Serial.print(a[j],HEX); // observe the image through serial port
Serial.print(" ");
}

TestFile.write((char*)a);
Serial.println();

i++;

}
TestFile.close();
Serial.print("Finished writing data to file");

while(1);
}

void SendResetCmd()
{
cameraSerial.write((byte)0x56);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x26);
cameraSerial.write((byte)0x00);
}

void SetImageSizeCmd()
{
cameraSerial.write((byte)0x56);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x31);
cameraSerial.write((byte)0x05);
cameraSerial.write((byte)0x04);
cameraSerial.write((byte)0x01);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x19);
cameraSerial.write((byte)0x11);
}

void SetBaudRateCmd()
{
cameraSerial.write((byte)0x56);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x24);
cameraSerial.write((byte)0x03);
cameraSerial.write((byte)0x01);
cameraSerial.write((byte)0xAE);
cameraSerial.write((byte)0xC8);

}

void SendTakePhotoCmd()
{
cameraSerial.write((byte)0x56);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x36);
cameraSerial.write((byte)0x01);
cameraSerial.write((byte)0x00);
}

void SendReadDataCmd()
{
MH=a/0x100;
ML=a%0x100;
cameraSerial.write((byte)0x56);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x32);
cameraSerial.write((byte)0x0c);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x0a);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)MH);
cameraSerial.write((byte)ML);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x20);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x0a);
a+=0x20;
}

void StopTakePhotoCmd()
{
cameraSerial.write((byte)0x56);
cameraSerial.write((byte)0x00);
cameraSerial.write((byte)0x36);
cameraSerial.write((byte)0x01);
cameraSerial.write((byte)0x03);
}

The error that i get,

sketch_aug16a:17: error: 'FAT' does not name a type
sketch_aug16a.ino: In function 'void setup()':
sketch_aug16a:38: error: 'TestFile' was not declared in this scope
sketch_aug16a.ino: In function 'void loop()':
sketch_aug16a:57: error: 'TestFile' was not declared in this scope

I also tried with File but it says file isnt a type..:frowning: Is there any other way of fixing this?

Make sure all your libraries are in the same folder (should just be xxx/Arduino/libraries)

use "code" tags
See # 7
http://forum.arduino.cc/index.php/topic,148850.0.html

Ashuk:
Hello people, i got an error when i compile my codings in arduino IDE saying that the declaration of a text file is wrong, I have added the sdFAT library but still i coudnt declare the Test file with the variable FAT. Can anyone help me to declare,

My coding is,

#include <SoftwareSerial.h>
#include <byteordering.h>
#include <fat.h>
#include <FAT16.h>
#include <fat_config.h>
#include <partition.h>
#include <partition_config.h>
#include <sd-reader_config.h>
#include <sd_raw.h>
#include <sd_raw_config.h>

I don't see:

#include <SdFat.h>

So you didn't add the SdFat library.

Read this before posting a programming question

How to use this forum