Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 函数采用结构的头文件中出现错误_C - Fatal编程技术网

C 函数采用结构的头文件中出现错误

C 函数采用结构的头文件中出现错误,c,C,这个标题怎么了?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 *p

这个标题怎么了?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

mmbox_stat_t struct在用于函数签名后声明。因此,当您声明以下内容时,编译器仍然不知道此类型:

int mmbox_stat(mmbox_stat_t *result);

将函数原型放在数据结构定义之后。

mmbox\u stat\t struct在用于函数签名后声明。因此,当您声明以下内容时,编译器仍然不知道此类型:

int mmbox_stat(mmbox_stat_t *result);
将函数原型放在数据结构定义之后