您好我在C项目工作;不幸的是,我有这个警告 如果有人愿意,我会感激不尽: 这是代码 .................................................. ........... .................................................. ....... ..................................
/*--------------------------------------------------------------*/
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 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;
};
`/
这是编译的结果
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’
答案 0 :(得分:2)
这个错误意味着在编译时没有可见的结构声明。只要您只需要指向它的指针,这种方法就可以正常工作,但如果您想知道大小,则必须有一个定义。