Error 'duplicate definition' when compiling 2 c files that reference 1 header file
- by super newbie
I have two C files and one header that are as follows:
Header file header.h:
char c = 0;
file1.c:
#include "header.h"
file2.c:
#include "header.h"
I was warned about 'duplicate definition' when compiling. I understand the cause as the variable c is defined twice in both file1.c and file2.c; however, I do need to reference the header.h in both c files. How should I overcome this issue?