Am trying to make a lightweight db created in runtime.
I store my data in a struct array.
Struct:
Code:
struct pt_struct
{
	u_char data[65];
	static int count;
};
Struct array creation:
Code:
pt_struct* InitPtDB(int Number)
{
	return((struct pt_struct*) calloc (Number,sizeof(pt_struct)));
}
Now the InitPtDB function is in a header file called functions.h which includes the header file containing the definition of the pt_struct.

I have a dialog class buttonOnClick function with the following code:
Code:
void CFrozenEyeDlg::OnBnClickedButton1()
{
	int i=0;
	Functions fun;
	pt_struct *pts=fun.InitPtDB(150);
	i=pts[0].count; //Error generated when i assigne count to i
	return;
}
Error message:
Code:
error LNK2001: unresolved external symbol "public: static int pkt_struct::count" (?count@pt_struct@@2HA)
The idea is to create a dynamic array of structs all with a static member count to trace the amount of pts array members initialized.
Because if i create array of pts[] with the size of 150, I may not use them all, meaning that i may have memory allocated for 150 pts elements but I only initialized 5, I need to know they are 5 and it's important to find it out using a static member in the struct definition for 2 reasons:
1.Something new i never tried and it's not working, and that motivates me
2.I think thats the only way, if there is another reason i'd appretiate the sharing but I also need to know whats wrong with what am doing !

In the end, how to resolve link errors any way !?

Thanks in advance