编译器是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)
答案 0 :(得分:1)
您需要以分号结束struct声明。当我开始用C语言编程时,这让我绊倒了很多次......
答案 1 :(得分:1)
struct strlist
{
char *data;
time_t *timestamp;
struct strlist *next;
};
^^^
|
您在结构声明结束时缺少;
。