具有采用结构的函数的头文件中的错误
这个标题有什么问题吗? Gcc 抛出:
libmmbox.h:7:29: error: expected ‘)’ before ‘*’ token
libmmbox.h:8:27: error: expected ‘)’ before ‘*’ token
这是我的代码:
#ifndef __LIBMMBOX_H__
#define __LIBMMBOX_H__
int mmbox_connect(char *username);
int mmbox_login(int token, char *password);
int mmbox_quit();
int mmbox_stat(mmbox_stat_t *result);
int mmbox_list(mmbox_mail **l, int *num_msg);
int mmbox_send(char *dest, char *obj, void *buf, size_t size);
int mmbox_rcv(int id, void *buf, size_t size);
int mmbox_delete(int id);
int mmbox_resume(int id);
typedef struct
{
char *user;
int used_space;
int free_space;
int num_msg;
} mmbox_stat_t;
typedef struct
{
char *sender, *recipient; /
char *obj, *date;
char flags;
size_t size;
} mmbox_mail;
#endif
What's wrong with this header? Gcc throws out:
libmmbox.h:7:29: error: expected ‘)’ before ‘*’ token
libmmbox.h:8:27: error: expected ‘)’ before ‘*’ token
Here's my code:
#ifndef __LIBMMBOX_H__
#define __LIBMMBOX_H__
int mmbox_connect(char *username);
int mmbox_login(int token, char *password);
int mmbox_quit();
int mmbox_stat(mmbox_stat_t *result);
int mmbox_list(mmbox_mail **l, int *num_msg);
int mmbox_send(char *dest, char *obj, void *buf, size_t size);
int mmbox_rcv(int id, void *buf, size_t size);
int mmbox_delete(int id);
int mmbox_resume(int id);
typedef struct
{
char *user;
int used_space;
int free_space;
int num_msg;
} mmbox_stat_t;
typedef struct
{
char *sender, *recipient; /
char *obj, *date;
char flags;
size_t size;
} mmbox_mail;
#endif
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
mmbox_stat_t 结构在用于函数签名后声明。因此,当您声明时,编译器仍然不知道这种类型:
将函数原型放在数据结构定义之后。
mmbox_stat_t struct is declared after it is used into a function signature. So the compiler doesn't still know this type when you declare:
Put your function prototypes after data structures definition.