Hello everyone,
I am building a code library in c to drive a keypad using atmega microcontroller,
for that i have created 2 files keypad.h and keypad.c
I am using GCC C compiler
when i try to declare a static variable in .h file and then define it in .c file, as follow;
.h file
static char passkey[];
static char passkey_mask[];
static int passkey_cursor;
.c file
static char passkey[PW_LENGTH];
static char passkey_mask[PW_LENGTH];
static int passkey_cursor = 0;
the compiler understand that there is 2 passkey_cursor variables with the same name and give me a warning that the one in the .h file is defined but never used
but for the arrays
passkey
and
passkey_mask
, everything is working fine.
Kindly i need your support,
Thanks in advance,
z3ngew
What I have tried:
if i remove this line from header file
static int passkey_cursor;
everything is fine, however the variable is not declared in the header file as i am intending to do