gpt4 book ai didi

java - TInyOS 1.x 编译 BLINK 时产生错误

转载 作者:行者123 更新时间:2023-11-28 08:30:33 25 4
gpt4 key购买 nike

root@everton-laptop:/opt/tinyos-1.x/apps/Blink#制作电脑

compiling Blink to a pc binary

ncc -o build/pc/main.exe -g -O0 -board=micasb -pthread -target=pc -Wall -Wshadow -DDEF_TOS_AM_GROUP=0x7d -Wnesc-all -fnesc-nido-tosnodes=1000 -fnesc-cfile=build/pc/app.c Blink.nc -lm

In file included from /opt/tinyos-1.x/tos/platform/pc/packet_sim.h:55,
from /opt/tinyos-1.x/tos/platform/pc/nido.h:81,
from /opt/tinyos-1.x/tos/platform/pc/hardware.h:43,
from /opt/tinyos-1.x/tos/system/tos.h:144:
/opt/tinyos-1.x/tos/types/AM.h:155: parse error before `struct'
/opt/tinyos-1.x/tos/types/AM.h:156: parse error before `struct'
/opt/tinyos-1.x/tos/types/AM.h:158: parse error before `struct'
/opt/tinyos-1.x/tos/types/AM.h: In function `TOS_MsgLength':
/opt/tinyos-1.x/tos/types/AM.h:186: parse error before `TOS_Msg'
In file included from /opt/tinyos-1.x/tos/platform/pc/hardware.h:116,
from /opt/tinyos-1.x/tos/system/tos.h:144:
/opt/tinyos-1.x/tos/platform/pc/eeprom.c: At top level:
/opt/tinyos-1.x/tos/platform/pc/eeprom.c:115: warning: declaration of `length' shadows global declaration
/opt/tinyos-1.x/tos/types/AM.h:158: warning: location of shadowed declaration
/opt/tinyos-1.x/tos/platform/pc/eeprom.c:145: warning: declaration of `length' shadows global declaration
/opt/tinyos-1.x/tos/types/AM.h:158: warning: location of shadowed declaration
make: *** [build/pc/main.exe] Error 1

尝试编译 BLink,我不断收到上述错误,但不确定下一步该怎么做。任何帮助都会很好。

最佳答案

查看 tos/types/AM.h 的 CVS 存储库,它看起来像是被以下代码窒息了:

154: enum {
155: MSG_DATA_SIZE = offsetof(struct TOS_Msg, crc) + sizeof(uint16_t), // 36 by default
156: TINYSEC_MSG_DATA_SIZE = offsetof(struct TinySec_Msg, mac) + TINYSEC_MAC_LENGTH, // 41 by default
157: DATA_LENGTH = TOSH_DATA_LENGTH,
158: LENGTH_BYTE_NUMBER = offsetof(struct TOS_Msg, length) + 1,
159: TINYSEC_NODE_ID_SIZE = sizeof(uint16_t)
160: };

第 155、156 和 158 行的共同项是 offsetof() 宏,它应该在 stddef.h 中定义,看起来应该是在 tos.h 导致包含 AM.h 之前由 tos.h 引入,因此应该已经定义了 offsetof()

您可能想验证您正在使用的编译器是否正确定义了 offsetof() 和/或为什么它不能用于 AM.h .如有必要,您可以使用或多或少常用的实现自己定义它:

#define offsetof(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))  // stolen from Wikipedia

关于java - TInyOS 1.x 编译 BLINK 时产生错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2349727/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com