该程序正在 Contiki 模拟器 Cooja 中运行。
这是给出错误的行:
n=(known_interest_list[*i].head_neighbour_list);
n
是一个邻居结构 *(指针)head_neighbour_list
是指向结构邻居列表头的指针 类型元素known_interest_list
是一个结构数组
结构体定义如下:
struct neighbor {
struct neighbor *next;
rimeaddr_t addr;
int last_rssi, last_lqi;
int count;
int update_time;
};
struct known_interest{
struct neighbour *head_neighbour_list;
int count;
int interest_no;
};
struct known_interest known_interest_list[MAX_INTERESTS];
错误是:
uniBroad.c:221:10: warning: assignment from incompatible pointer type [enabled by default]
我知道这是一个非常基本的错误,但我绝对确保赋值语句两边的数据类型相同。尽管如此,这个错误还没有得到解决。
最佳答案
这似乎是 locales 的问题;)。除非您仅在问题中出现拼写错误,否则有两种不同的 struct neighbo[u]r
类型
struct neighbour *head_neighbour_list // in the known_interest
struct neighbor *next // in the struct neighbor itself
known_interest
中有一个额外的 u
关于c - 不兼容指针类型的赋值——Contiki C 程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27432107/