C code - declaring global variable

Flaviu_
606
Reputation points
I have a legacy code:
// file3.h
extern int g_index;
// file3.c
int g_index= -1;
// file1.c
g
index = some_value
;
Compiles and works fine. But, the quality tools says:
Don't use extern variable declarations in header files, except for consts.
How can I overcome this ?