I’ve written a little header file, and I keep getting this error:
expected specifier-qualifier-list before ‘ObjectP’
I’ve been looking for an answer and I understand that it’s because of the way the compiler parses the text. ObjectP is defined in GenericHashTable.h which is included as you can see. I’ve tried writing the #include AFTER defining the struct, didn’t help. Here’s the problematic code with error line marked:
#include "GenericHashTable.h"
typedef struct List* ListP;
typedef struct List
{
unsigned int size;
ObjectP head; <----- ERROR HERE
} List;
Any ideas? thanks!
EDIT: I think I know where the problem is. “List.h” includes “GenericHashMap.h” and vice versa, so I have kind of a circular dependency. When I remove the #include statement from one of them it compiles OK and the other one gets the error message.
Must I somehow break this circle, or is there another solution? Thanks!
I’m not 100% sure of this solution, since I do not see your
GenericHashTable.h. But It would help if you make the definition ofObjectPin another header file which is included by yourGenericHashTable.hand your header defining the list.