This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Keil Error: L6218E undefined symbol to *a struct*

Hi,

I am trying to compile my code but I am ending up with 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 which will be used in multiple source files?