That's not exactly a clear explanation, but ..... Lemme guess. You copy/pasted the struct definition to the end of the source files. You need to copy it to the beginning.
A C compiler doe not read a whole file, and then work out if the contents make sense. It scans from the beginning to the end (not the other way around) and also needs to see things declared before they are used. So this will compile
Code:
struct Foo {int i;};
void func(struct Foo *x)
{
x->i = 42;
}
but this will not
Code:
void func(struct Foo *x)
{
x->i = 42;
}
struct Foo {int i;};
The only difference is the position of the struct definition.