What means this error?
The forward declaration
typedef struct _Dictionary_t *Dictionary;
doesn't give a clue as to what members struct _Dictionary_t
might have.
You cannot use main_dict->size
unless the definition of struct
is visible at that point in the code. Since the definition of the struct
is in dictionary.c
, its definition is not visible to anything in main.c
.
How I can fix it?
Solution 1
Move the definition of the struct
to the .h file.
Solution 2
Provide functions that allow you to get and set the members of the struct
.
In dictionary.h:
void setDictionarySize(Dictionary dict, int size);
int getDictionarySize((Dictionary dict);
Implement them in dictioary.c.
Use the function in main.c. Replace
a = main_dict->size;
by
a = getDictionarySize(main_dict);