想请教老师这个warning是什么问题:will not be visible outside of this function
来源:3-10 案例:猜数字的游戏

程序员班吉
2021-03-01
老师,想请教一下这个warning是因为什么导致的
event_dispatcher.h:13:26: warning: declaration of ‘struct event_loop’ will not be visible outside of this function [-Wvisibility]
void *(*init)(struct event_loop *);
event_dispatcher.h代码如下:
struct event_dispatcher {
const char *name;
void *(*init)(struct event_loop *);
// add channel event and notify dispatcher
int (*add)(struct event_loop *, struct channel *ch);
// delete channel event and notify dispatcher
int (*del)(struct event_loop *, struct channel *ch);
// update channel event and notify dispatcher
int (*update)(struct event_loop *, struct channel *ch);
// dispatcher and use event_loop callback use event_activate
int (*dispatch)(struct event_loop *, struct timeval *);
void (*clear)(struct event_loop *);
};
写回答
1回答
-
bennyhuo
2021-03-01
因为这个结构体前面没有定义,这里就成了函数作用域内定义的类型了,所以出了函数不可见。估计这个类型应该在其他地方有定义。
022021-03-05
相似问题