[英]Error on typedef struct. before '*' token
The compiler is gcc and I'm using an old version of linux 编译器是gcc,我使用的是旧版本的linux
typedef struct strlist strlist;
struct strlist
{
char *data;
time_t *timestamp;
struct strlist *next;
}
strlist * list_directory(char *dirname)
{
//do something
}
The error message is: 错误消息是:
error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
and it's on the line: 它就在线上:
strlist * list_directory(char *dirname)
You need to end the struct declaration with a semicolon. 您需要以分号结束struct声明。 That tripped me up so many times when I started programming in C...
当我开始用C语言编程时,这让我绊倒了很多次......
struct strlist
{
char *data;
time_t *timestamp;
struct strlist *next;
};
^^^
|
You are missing the ;
你错过了
;
at the end of structure declaration. 在结构声明的最后。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.