编译器是gcc,我使用的是旧版Linux

typedef struct strlist strlist;

struct strlist
{
    char *data;
    time_t *timestamp;
    struct strlist *next;
}

strlist * list_directory(char *dirname)
{
//do something
}


错误消息是:

error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token


它就在网上:

strlist * list_directory(char *dirname)

最佳答案

struct strlist
{
    char *data;
    time_t *timestamp;
    struct strlist *next;
};
^^^
 |


您在结构声明的末尾缺少;

关于c - 在typedef结构上出错。在“*” token 之前,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/13171544/

10-13 08:34