2010-02-28 6 views
0

root @ everton-ordinateur portable: /opt/tinyos-1.x/apps/Blink# faire pcTinyOS 1.x Génération d'une erreur lors de la compilation 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 

Essayé compilation et BLINK je continue à recevoir ce qui précède erreur et ne savez pas quoi faire ensuite. toute aide serait bien.

Répondre

1

Regarder le dépôt CVS pour tos/types/AM.h, on dirait qu'il étouffe sur le code suivant:

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: }; 

L'élément commun des lignes 155, 156 et 158 ​​sont la macro, offsetof() qui devrait être défini dans stddef.h et qui devrait avoir été introduit par le tos.h avant que cela n'inclue AM.h, donc offsetof() devrait déjà être défini.

Vous pouvez vérifier si le compilateur que vous utilisez a correctement défini offsetof() et/ou pourquoi il n'est pas disponible pour utilisation dans AM.h. Si nécessaire, vous pouvez probablement le définir vous-même en utilisant une implémentation plus ou moins habituelle:

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

va essayer de mettre à jour le compilateur et voir si cela réglerait le problème – ferronrsmith