c - 不兼容指针类型的赋值——Contiki C 程序

标签 c pointers contiki

该程序正在 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/

相关文章:

c - 调用时绘制

c - gcc multiple -o 选项如何工作?

在 Arduino Due 上使用 contikiOS 进行 C 或 C++ 编程

c - Z1 motes - 基站和传感节点之间的通信

c - 如何在 Contiki OS 中打印传入的数据包?

C套接字,recv丢失数据

c - c代码错误

c++ - 从 C++ 函数返回指针或引用

c - C 会自动释放没有指针的内存吗?

不能给变量和指针赋值