首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TInyOS 1.x在编译闪烁时生成错误

TInyOS 1.x在编译闪烁时生成错误
EN

Stack Overflow用户
提问于 2010-02-28 09:36:54
回答 1查看 688关注 0票数 0

root@everton-laptop:/opt/tinyos-1.x/apps/Blink# make pc

代码语言:javascript
复制
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,但我一直收到上面的错误,不确定下一步该怎么做。任何帮助都会很好。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-02-28 11:30:52

查看tos/types/AM.h的CVS存储库,它似乎被以下代码卡住了:

代码语言:javascript
复制
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中定义,并且看起来应该在包含AM.h之前由tos.h引入,所以offsetof()应该已经定义好了。

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

代码语言:javascript
复制
#define offsetof(st, m) ((size_t) ( (char *)&((st *)(0))->m - (char *)0 ))  // stolen from Wikipedia
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2349727

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档