I have the following C code:
#include <stdio.h>
#include "helper.h"
int main(int argc, char ** argv){
if (argc < 4){
fprintf(stderr, "Usage: ./program_name <DISK> <LOCAL_FILE> <DESTINATION> \n");
exit(1);
}
FILE * target;
}
helper.h is defined as follows:
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <string.h>
/*
A bunch of function headers and global variables below, none of which
are called target.
*/
When I try to compile the above with the following command:
gcc -Wall -o program_name program_name.c
I get the following errors:
program_name.c:19:12: error: use of undeclared identifier 'target'
FILE * target;
^
1 error generated.
I've found that deleting the #include "helper.h"
statement in the original program stops the compilation errors...but the problem is that I sort of need the methods defined in helper.h
and helper.c
to complete the program. Any idea what's wrong with it? I'm at my wit's end.