-1
我不知道爲什麼會發生這種情況。我正在做一個任務,代碼不知道怎麼編譯。錯誤:在訪問結構體時取消引用指向不完整類型的指針
這是頭文件
#include <stdint.h>
typedef struct
{
uint8_t jump_code[3]; /* Ignore this */
char oemname[8]; /* Might as well ignore this one too */
uint8_t ssize[2]; /* Sector size in bytes */
uint8_t csize; /* Cluster size in sectors */
uint8_t reserved[2]; /* Number of reserved sectors for boot sectors */
uint8_t numfat; /* Number of FATs */
uint8_t numroot[2]; /* Number of Root directory entries */
uint8_t sectors16[2]; /* number of sectors in the file system */
uint8_t media[1]; /* Media descriptor type */
uint8_t sectperfat16[2];/* Number of sectors per FAT */
uint8_t sectpertrack[2];/* Number of sectors per track */
uint8_t heads[2]; /* Number of heads */
uint8_t prevsect[2]; /* Number of sectors before FS partition */
uint8_t ignore[482]; /* Ignore these */
} boot_sect_t;
這是給出了錯誤的部分:
struct boot_sect_t* boot = malloc(sizeof(boot_sect_t));
boot->ssize[0] = buffer[11]; //error here
boot->ssize[1] = buffer[12]; //error here
的錯誤是:
error: dereferencing pointer to incomplete type when accessing struct
什麼是 緩衝區的類型? – 2014-11-25 06:09:52
@Jefffrey我認爲他把這隻作爲問題標題。第一次定時器常見:-) – 2014-11-25 06:12:36
@SouravGhosh謝謝。 – Shoe 2014-11-25 06:13:16