DNKROZ DNKROZ - 1 year ago 72
C Question

undeclared identifier - unsure as to why

I am just learning C

I have written the following:

void main(void)
unsigned int curr_dat = 0; // The current dat file to use
unsigned char ch = 0; // Key entered at keyboard
unsigned char lastkey = 0; // Last key entered (movement command)
FILE *fp;

However i am getting these errors when trying to compile:

error C2065: 'FILE' : undeclared identifier

error C2065: 'fp' : undeclared identifier

warning C4552: '*' : operator has no effect; expected operator with side-effect

I'm unsure why as i believe
is a valid identifier in C

I am using Developer Command Prompt for VS2012 to compile

Answer Source

FILE is declared in stdio.h. Add #include <stdio.h> to the top of your file.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download