I have a C project that has worked out well, and now I want to break the program into three files, to make the functions reusable.
In doing so, I found that I get linker errors. The abc.c file compiles cleanly.
But compiling abc_example.c gives an error like this:
duplicate symbol '_MAX_VALUE' in:
/private/var/folders/abc_example-633d99.o
/Users/me/programs/abc.o
ld: 1 duplicate symbols
clang: error: linker command failed with exit code 1 (use -v to see invocation)
int MAX_VALUE = 0;
extern int MAX_VALUE; // in the abc.h file
int MAX_VALUE = 0; // in the abc.c file