Hi, I'm quite new to C. I have 4 .h files and one header file.
header.h
Code:
//variables
extern char CWD[PATH_MAX];
fileio.c
Code:
char CWD[PATH_MAX];
strcpy(CWD,temp);
haar.c
Code:
strcpy(imagePath, CWD);
I'm getting the error:
haar.c:62: undefined reference to `CWD'
I've looked around the net quite a bit about extern variables and this seems to be the right thing to do - declare extern in header (which is included in every .c file) and then initialise it once (in fileio.c) and use it anywhere (in haar.c).
Why am i still getting this error?