contiki-z1-main.c : “undefined reference to 'autostart_processes'”

点点圈 提交于 2019-12-11 12:07:13

问题


When I try to compile a .c file with Cooja, Contiki, there are these errors:

 contiki-z1-main.c(.init9+0x200): undefined reference to `autostart_processes`
 contiki-z1-main.c(.init9+0x224): undefined reference to `autostart_processes`

Does anyone know the issue?


回答1:


You haven't defined the AUTOSTART_PROCESSES(), so Contiki does not know where to start executing your application.

For eg Blink,

PROCESS(blink_process, "Blink example");
AUTOSTART_PROCESSES(&blink_process);



回答2:


Becasuse of that the "AUTOSTART_PROCESSES" is defined not correctly.

In file "autostart.h",you could find the code there:

#if AUTOSTART_ENABLE
#define AUTOSTART_PROCESSES(...)                    \
struct process * const autostart_processes[] = {__VA_ARGS__, NULL}
#else /* AUTOSTART_ENABLE */
#define AUTOSTART_PROCESSES(...)                    \
extern int _dummy

So if you dont't define "AUTOSTART_ENABLE" as 1, the autostart function won't work, and your process will not start.



来源:https://stackoverflow.com/questions/20686384/contiki-z1-main-c-undefined-reference-to-autostart-processes

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!