I am using Keil MDK ARM to develop a project. However, when I am trying to build my code, the software tool throws the ERROR: L6218E : Undefined symbol Bit (referred from main.o). Where Bit is a struct that I am using to store boolean values. For eg:
In variable.h file
struct
{
unsigned bPowerONStatus : 1;
unsigned bTimerONStatus : 1;
} extern Bit;
In main.c file:
#include variable.h
int main()
{
while(1)
{
ReadTimerStatus();
if(Bit.bPowerONStatus)
{
// System is ON
}
else
{
// System if OFF
}
}
}
In PowerChecker.c file
#include variable.h
void ReadTimerStatus(void)
{
if(Bit.bTimerONStatus)
{
Bit.bPowerONStatus = 1;
}
else
{
Bit.bPowerONStatus = 0;
}
}
What am I doing wrong here? What is the correct method of defining a struct, that will be used in multiple source files?