struct instance "undeclared" (first use in this function)
I'm having trouble getting some code to compile...the following code gives me the error:
'Chunk' undeclared (first use in this function)
when compiled with "make" in cygwin.
Code:
//create structure for holding chunk data
struct Chunk
{
unsigned short ID; //first two bytes
unsigned int size; //last four bytes
};
int main() {
pspDebugScreenInit();
SetupCallbacks();
printf("3DS Loader version 0.1\n");
printf("======================\n");
printf("by David Reicher\n");
//setup file name
char* filename;
filename = "ms0:/xwing.3ds";
int fdin;
//open file and start reading
fdin = sceIoOpen(filename, PSP_O_RDONLY, 0777);
if(fdin >= 0)
{
printf("File opened %s\n\n", filename);
Chunk firstChunk;
int bytes_read = 1;
bytes_read = sceIoRead(fdin, &firstChunk->ID, sizeof(firstChunk->ID));
printf("ID: 0x%x\n", firstChunk.ID);
bytes_read = sceIoRead(fdin, &firstChunk->size, sizeof(firstChunk->size));
printf("Chunksize: %u\n", firstchunk.size);
}
else
{
printf("Couldn't open %s\n", filename);
}
//wait for home button push, then exit
sceKernelSleepThread();
return 0;
}
I know I'm probably doing something stupid (I'm kind of a newbie), but could anyone give me some advice on where I'm going wrong?