Is there an easy explanation for what this error means?
request for member '*******' in something not a structure or union
I've encountered it several times in the time that I've been learning C, but I haven't got a clue as to what it means.
Is there an easy explanation for what this error means?
request for member '*******' in something not a structure or union
I've encountered it several times in the time that I've been learning C, but I haven't got a clue as to what it means.
The compiler is telling you that you are trying to access a member of a structure, but the structure does not have a member with that name. For example:
struct {
int a;
int b;
int c;
} foo;
foo.d = 5;
There is no member of struct foo
called 'd', so it will give you this error.
It also happens if you're trying to access an instance when you have a pointer, and vice versa:
struct foo
{
int x, y, x;
};
struct foo a, *b = a;
b.x = 12; /* This will generate the error, should be b->x or (*b).x */
You are trying to access a member of a structure, but in something that is not a structure. For example:
struct {
int a;
int b;
} foo;
int fum;
fum.d = 5;