谁能解释为什么这段代码无法编译?
主程序
typedef struct ext2_group_desc
{
unsigned long bg_block_bitmap; /* Blocks bitmap block */
unsigned long bg_inode_bitmap; /* Inodes bitmap block */
unsigned long bg_inode_table; /* Inodes table block */
unsigned int bg_free_blocks_count; /* Free blocks count */
unsigned int bg_free_inodes_count; /* Free inodes count */
unsigned int bg_used_dirs_count; /* Directories count */
unsigned int bg_pad;
unsigned long bg_reserved[3];
} group_desc;
int main() {
char buf[1024];
group_desc gd;
gd = (group_desc) buf;
return(0);
}
终端
$ bcc -ansi -c test.c
test.c:7.26: error: need scalar or pointer or void
test.c:7.26: error: assignment to/from struct/union of a different type
$