结构体问题

[复制链接]
 楼主| dfsa 发表于 2012-7-29 12:17 | 显示全部楼层 |阅读模式
我编写了下面住的那结构体,就是在一个结构体中嵌套一个结构体数组;程序如下:
typedef struct
{
struct data TXBUF[CAN_TXBUF_LENGTH];
volatile uint32_t head; /*!< ReceiveData Tx ring buffer head index */
volatile uint32_t tail; /*!< ReceiveData Tx ring buffer tail index */
volatile uint32_t number;
}CAN_TXBUF;

typedef struct
{
uint32_t Frame;
uint32_t MsgID;
uint32_t DataA;
uint32_t DataB;
};
struct data TXBUF[CAN_TXBUF_LENGTH];
哪位高手能指出哪里错了??
gxgclg 发表于 2012-7-29 12:31 | 显示全部楼层
typedef struct  
{
uint32_t Frame;   
uint32_t MsgID;  
uint32_t DataA;  
uint32_t DataB;
};
缺少名字

typedef struct   
{
  struct data TXBUF[CAN_TXBUF_LENGTH];//!定义结构体时其成员不能指定存储位置,把data去掉
  volatile uint32_t head; /*!< ReceiveData Tx ring buffer head index */
  volatile uint32_t tail; /*!< ReceiveData Tx ring buffer tail index */
  volatile uint32_t number;   
}CAN_TXBUF;
无冕之王 发表于 2012-7-29 12:40 | 显示全部楼层
typedef struct  
{
uint32_t Frame;   
uint32_t MsgID;  
uint32_t DataA;  
uint32_t DataB;
};
缺少名字

typedef struct   
{
  struct data TXBUF[CAN_TXBUF_LENGTH];//!定义结构体时其成员不能指定存储位 ...
gxgclg 发表于 2012-7-29 12:31

这样应该就可以了
txcy 发表于 2012-7-29 12:52 | 显示全部楼层
试试LS的方法,感觉可行
您需要登录后才可以回帖 登录 | 注册

本版积分规则

282

主题

2404

帖子

2

粉丝
快速回复 在线客服 返回列表 返回顶部