我有这个问题,无法看到错误在哪里,所以我希望有人可以帮助解决它.我从编译源代码得到的错误是:
client.c:15:54: error: invalid application of ‘sizeof’ to incomplete type ‘struct client’
Run Code Online (Sandbox Code Playgroud)
我在头文件中有结构定义 - client.h:
#ifndef PW_CLIENT
#define PW_CLIENT
#include <event2/listener.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
struct client {
int id;
struct bufferevent *bev;
struct client *prev;
struct client *next;
};
struct client *client_head = NULL;
struct client* client_connect(struct bufferevent *bev);
#endif
Run Code Online (Sandbox Code Playgroud)
这是client.c的源代码:
#include <event2/listener.h>
#include <event2/bufferevent.h>
#include <event2/buffer.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
struct client* client_connect(struct bufferevent *bev) { …Run Code Online (Sandbox Code Playgroud)