"Dereferencing pointer to incomplete type", typedefs are ok
<p>I'm trying to implement a hash table. I get the above error but AFAIK I've properly declared all my structs/typedefs. (I'm still learning C, sorry)
The error occurs in test.c in my while loop, where I've put //ERROR. What's wrong?</p>

<p>test.c</p>

<pre><code>#include "mentry.h"
#include "mlist.h"

int main() {
  FILE *fPtr = fopen("S.txt", "r");
  MList *ml = ml_create();

  MEntry *m2;
  int i = 1;
  while ((m2 = me_get(fPtr)) != NULL) {
    unsigned long int hash = me_hash(m2, ml-&gt;numbuckets); // ERROR HERE
    i++;
  }

  return 0;
}
</code></pre>

<p>mlist.c</p>

<pre><code>#include "mentry.h"
#include "mlist.h"

#define NUMBUCKETS 3
#define BUCKETSIZE 5

typedef struct bucket {
  int size; // number of elements in this bucket
  MEntry *entries; // array of MEntries
} Bucket;

typedef struct mlist {
  int numbuckets; // number of buckets
  Bucket **buckets; // an array of Bucket pointers
} MList;

/* ml_create  - creates a new mailing list
              - returns pointer to start of mailing list*/
MList *ml_create(void) {
  MList *ml = malloc(sizeof(MList));

  ml-&gt;numbuckets = NUMBUCKETS; // random initial number
                               // will increment once a bucket is full

  // init Buckets
  int b;
  for (b=0; b&lt;ml-&gt;numbuckets; b++) {
    Bucket *bk = malloc(sizeof(Bucket));
    bk-&gt;size = 0;
    bk-&gt;entries = calloc(BUCKETSIZE, sizeof(MEntry));
    ml-&gt;buckets[b] = bk;
  }

  return ml;
}
</code></pre>

<p>mlist.h</p>

<pre><code>#ifndef _MLIST_H_
#define _MLIST_H_

#include "mentry.h"

typedef struct mlist MList;

/* ml_create  - creates a new mailing list
              - returns pointer to start of mailing list*/
MList *ml_create(void);

#endif /* _MLIST_H_ */
</code></pre>