C expression must have pointer to struct or union type -


i'm using ccs v6 , there error structure grammar.

typedef struct _mem_ptr_t {     struct _mem_ptr_t *next;    ///< next pointer in memory     uint8    alloc;              ///< allocated     struct  mmem mmem_ptr;      ///< actual pointer pointer mem block } mem_ptr_t;  struct mmem {   struct mmem *next;   unsigned int size;   void *ptr; }; 

above code original state. there error. "#71 incomplete type not allowed "

so, had changed code "struct mmem mmem_ptr; " -> "struct mmem *mmem_ptr; " when had compiling, part passed.

but part occurred error.

if ((mem_ptr = mac_scan_alloc()) != null) {         memcpy(&scan_entry(mem_ptr)->oord_addr, src_addr, sizeof(address_t));         scan_entry(mem_ptr)->superfrm_spec = superframe_spec;         scan_entry(mem_ptr)->coord_pan_id = src_pan_id;         scan_entry(mem_ptr)->channel = channel;     } #define scan_entry(m)  ((pan_descr_t *)mmem_ptr(&m->mmem_ptr))  

there error "#133 expression must have pointer-to-struct-or-union type"

i had looked related question problem. couldn't understand solve above problem. expression must have pointer struct or union error

what should fix code solve problem?

struct _mem_ptr_t uses struct mmem before defined. swap definitions:

struct mmem {   struct mmem *next;   unsigned int size;   void *ptr; };  typedef struct _mem_ptr_t {     struct _mem_ptr_t *next;    ///< next pointer in memory     uint8    alloc;              ///< allocated     struct  mmem mmem_ptr;      ///< actual pointer pointer mem block } mem_ptr_t; 

changing definition of mmem_ptr struct mmem struct mmem * doesn't work because you're changing type, code uses not doing properly.


Comments