-3

Hi I'm working in C project ; unfortunatly i have this warnings I'will be thankful if someone would hepl me : Here is the code ............................................................. ......................................................... ..................................

/*--------------------------------------------------------------*/
63:static void /*  the RREQ message is send in broadcast to all 
64:                neighbors through all its interfaces*/
65:send_rreq(struct route_discovery_conn *c, const rimeaddr_t *dest)
66:{
67:  rimeaddr_t dest_copy;
68:  struct route_discovery_packet *msg;
69:
70:  rimeaddr_copy(&dest_copy, dest);
71:  dest = &dest_copy;
73:
74:  packetbuf_clear();
75:  msg = packetbuf_dataptr();
76:  packetbuf_set_datalen(sizeof(struct route_discovery_packet));
77:
78:  msg->type = "0x0" ; 
79:  rimeaddr_copy(&msg->dest, dest);
80: // msg->metric_type ////////// wa have chosen as default metrric type hop_count ////////
81:  msg->route_metric = 0; 
82:  msg->hop_count = 0;
83:  msg->hop_limit = MAX_HOP_LIMIT;
84:  
85:
86:  netflood_send(&c->rreqconn, c->seqno); // Message transmission
87:  c->seqno ++;
89:}

this is the header file :

/*  This structure points to the information of RREQ/RREP packet*/
struct route_discovery_packet { 
  // struct tlv ;
  char type;  
  uint8_t seqno;
  uint8_t route_metric; // specifies the route metric of the route
  char metric_type; // pecifies the type of metric requested by this RREQ
  uint8_t hop_count; // specifies the total number of hops from the originator 
  uint8_t hop_limit;
  rimeaddr_t dest;
  rimeaddr_t originator;
  rimeaddr_t local_iface_addr;

};
`/

here is the result of compilation

route-discovery.c: In function ‘send_rreq’:
route-discovery.c:76:32: erreur: invalid application of ‘sizeof’ to incomplete type ‘struct route_discovery_packet’ 
route-discovery.c:78:6: erreur: déréférencement d'un pointeur de type incomplet
route-discovery.c:79:21: erreur: déréférencement d'un pointeur de type incomplet
route-discovery.c:81:6: erreur: déréférencement d'un pointeur de type incomplet
route-discovery.c:82:6: erreur: déréférencement d'un pointeur de type incomplet
route-discovery.c:83:6: erreur: déréférencement d'un pointeur de type incomplet
route-discovery.c:86:32: erreur: ‘struct route_discovery_conn’ has no member named ‘seqno’
route-discovery.c:87:4: erreur: ‘struct route_discovery_conn’ has no member named ‘seqno’
tnw
  • 13,521
  • 15
  • 70
  • 111
  • 1
    pro tip: use `LANG=EN` in front of your compiler command to get english output. – niklasfi Apr 17 '14 at 14:19
  • Do not tag spam for visibility. I have removed irrelevant tags from your question. – tnw Apr 17 '14 at 14:20
  • 1
    This is a repeated topic. [Here](http://stackoverflow.com/questions/8915230/invalid-application-of-sizeof-to-incomplete-type-with-a-struct) , [here](http://stackoverflow.com/questions/17211345/invalid-application-of-sizeof-to-incomplete-type-list-struct-c) and [here](http://stackoverflow.com/questions/12873142/invalid-application-of-sizeof-to-incomplete-type-struct-array) – Jalal Mostafa Apr 17 '14 at 14:24

1 Answers1

2

This errror means that no declaration of your structure is visible at that point of compilation. This works well as long as you only need a pointer to it, but if you want to know the size, you have to have a definition.

Jens Gustedt
  • 76,821
  • 6
  • 102
  • 177