froghui / yolanda Goto Github PK
View Code? Open in Web Editor NEW极客时间<网络编程实战>代码
极客时间<网络编程实战>代码
Lines 113 to 116 in 4d0630b
httpRequest在任何情况都应该重置?而不是仅仅在连接关闭的时候,不然从浏览器每次访问的都是同一个页面(不管url是否一样)
if (http_request_close_connection(httpRequest)) {
tcp_connection_shutdown(tcpConnection);
}
http_request_reset(httpRequest);
event_loop_channel_buffer_nolock 里fd完全没用到,code里也没什么有用的comment。。。越看越凌乱。。
最后一章 http_server01 执行后,curl -v http://127.0.0.1:43211/ 服务端出现 Segmentation fault (core dumped)
./http_server01
[msg] set epoll as dispatcher, main thread
[msg] add channel fd == 5, main thread
[msg] set epoll as dispatcher, Thread-1
[msg] add channel fd == 9, Thread-1
[msg] event loop thread init and signal, Thread-1
[msg] event loop run, Thread-1
[msg] event loop thread started, Thread-1
[msg] set epoll as dispatcher, Thread-2
[msg] add channel fd == 12, Thread-2
[msg] event loop thread init and signal, Thread-2
[msg] event loop run, Thread-2
[msg] event loop thread started, Thread-2
[msg] add channel fd == 6, main thread
[msg] event loop run, main thread
[msg] epoll_wait wakeup, main thread
[msg] get message channel fd==6 for read, main thread
[msg] activate channel fd == 6, revents=2, main thread
[msg] new connection established, socket == 13
[msg] connection completed
[msg] epoll_wait wakeup, Thread-1
[msg] get message channel fd==9 for read, Thread-1
[msg] activate channel fd == 9, revents=2, Thread-1
[msg] wakeup, Thread-1
[msg] add channel fd == 13, Thread-1
[msg] epoll_wait wakeup, Thread-1
[msg] get message channel fd==13 for read, Thread-1
[msg] activate channel fd == 13, revents=2, Thread-1
[msg] get message from tcp connection connection-13
Segmentation fault (core dumped)
有同学遇到吗
在build目录下make时,出现以下错误:
/root/geekbang/yolanda/chap-5/tcpclient.c: In function ‘send_data’:
/root/geekbang/yolanda/chap-5/tcpclient.c:8:5: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int i = 0; i < MESSAGE_SIZE; i++) {
^
/root/geekbang/yolanda/chap-5/tcpclient.c:8:5: note: use option -std=c99 or -std=gnu99 to compile your code
make[2]: *** [chap-5/CMakeFiles/tcpclient.dir/tcpclient.c.o] Error 1
make[1]: *** [chap-5/CMakeFiles/tcpclient.dir/all] Error 2
make: *** [all] Error 2
是否需要在CMakeLists.txt中添加以下选项呢?
set(CMAKE_C_STANDARD 99)
课程最后的高性能http有完整的代码吗?怎么只看到 chap33的部分代码,还是我没找对地方。。。
老师你好,我想问一下我在敲网络编程代码的时候经常遇到缺少函数对应的头文件,有时候在ubuntu下编译经常一些问题半天解决不了,我想是不是先把所有的头文件都导入进来就像unp.h一样,关注于网络编程的本身,然后熟练了再去细节探索呢,小白哈
/usr/bin/cmake --build /mnt/f/NetworkProgrammingPractice/Chapter28/cmake-build-debug --target poll-server-multithreads -- -j 2
[ 75%] Built target yolanda
[ 87%] Linking C executable ../bin/poll-server-multithreads
CMakeFiles/poll-server-multithreads.dir/poll-server-multithreads.c.o: In function onMessage': /mnt/f/NetworkProgrammingPractice/Chapter28/chap-28/poll-server-multithreads.c:26: undefined reference to
buffer_new'
/mnt/f/NetworkProgrammingPractice/Chapter28/chap-28/poll-server-multithreads.c:27: undefined reference to buffer_readable_size' /mnt/f/NetworkProgrammingPractice/Chapter28/chap-28/poll-server-multithreads.c:29: undefined reference to
buffer_read_char'
/mnt/f/NetworkProgrammingPractice/Chapter28/chap-28/poll-server-multithreads.c:29: undefined reference to buffer_append_char' /mnt/f/NetworkProgrammingPractice/Chapter28/chap-28/poll-server-multithreads.c:31: undefined reference to
tcp_connection_send_buffer'
CMakeFiles/poll-server-multithreads.dir/poll-server-multithreads.c.o: In function main': /mnt/f/NetworkProgrammingPractice/Chapter28/chap-28/poll-server-multithreads.c:49: undefined reference to
event_loop_init'
/mnt/f/NetworkProgrammingPractice/Chapter28/chap-28/poll-server-multithreads.c:52: undefined reference to acceptor_init' /mnt/f/NetworkProgrammingPractice/Chapter28/chap-28/poll-server-multithreads.c:56: undefined reference to
tcp_server_init'
/mnt/f/NetworkProgrammingPractice/Chapter28/chap-28/poll-server-multithreads.c:58: undefined reference to tcp_server_start' /mnt/f/NetworkProgrammingPractice/Chapter28/chap-28/poll-server-multithreads.c:61: undefined reference to
event_loop_run'
collect2: error: ld returned 1 exit status
chap-28/CMakeFiles/poll-server-multithreads.dir/build.make:95: recipe for target 'bin/poll-server-multithreads' failed
make[3]: *** [bin/poll-server-multithreads] Error 1
CMakeFiles/Makefile2:179: recipe for target 'chap-28/CMakeFiles/poll-server-multithreads.dir/all' failed
make[2]: *** [chap-28/CMakeFiles/poll-server-multithreads.dir/all] Error 2
CMakeFiles/Makefile2:191: recipe for target 'chap-28/CMakeFiles/poll-server-multithreads.dir/rule' failed
make[1]: *** [chap-28/CMakeFiles/poll-server-multithreads.dir/rule] Error 2
Makefile:190: recipe for target 'poll-server-multithreads' failed
make: *** [poll-server-multithreads] Error 2
老师你好:
cmake的时候遇到了这个问题,是什么原因呢,没找到config.h的代码呢。
/yolanda/chap-5/lib/common.h:8:20: error: config.h: No such file or directory
如果我把config.h注释掉,又有如下错误:
[ 50%] Linking C executable tcpserver
/usr/bin/ld: cannot find -lyolanda
yolanda 找不到这个个库
➜ build git:(master) ✗ cmake .. && make
-- Configuring done
-- Generating done
-- Build files have been written to: /www/projects/yolanda/build
[ 18%] Built target yolanda
[ 20%] Built target make_socket
[ 21%] Built target tcpserver
[ 23%] Built target tcpclient
[ 25%] Built target udpserver
[ 26%] Built target udpclient
[ 28%] Built target unixdataserver
[ 30%] Built target unixdataclient
[ 32%] Built target unixstreamclient
[ 34%] Built target unixstreamserver
[ 36%] Built target graceserver
[ 37%] Built target graceclient
[ 38%] Built target pingserver
[ 40%] Built target pingclient
[ 42%] Built target batchwrite
[ 44%] Built target addressused02
[ 45%] Built target addressused
[ 47%] Built target streamserver
[ 49%] Built target streamclient
[ 51%] Built target reliable_client02
[ 52%] Built target reliable_server02
[ 54%] Built target reliable_server01
[ 56%] Built target reliable_client01
[ 58%] Built target samplebuffer02
[ 60%] Built target samplebuffer01
[ 62%] Built target samplebuffer03
[ 64%] Built target bufferclient
[ 66%] Built target telnet-server
[ 68%] Built target telnet-client
[ 70%] Built target select01
[ 72%] Built target pollserver
[ 74%] Built target nonblockingclient
[ 76%] Built target nonblockingserver
[ 78%] Built target fork01
[ 80%] Built target thread-helloworld
[ 83%] Built target thread02
[ 86%] Built target thread01
[ 88%] Built target poll-server-onethread
[ 90%] Built target poll-server-multithreads
[ 92%] Built target test01
[ 94%] Built target epoll-server-multithreads
[ 95%] Linking C executable ../bin/aio01
ld: library not found for -lrt
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/aio01] Error 1
make[1]: *** [chap-30/CMakeFiles/aio01.dir/all] Error 2
make: *** [all] Error 2
@froghui 老师好, 执行的时候报了这个错, 比较了一下chap-30的CMakeLists.txt
add_executable(aio01 aio01.c)
target_link_libraries(aio01 yolanda rt)
及chap-29的CMakeLists.txt
add_executable(epoll-server-multithreads epoll-server-multithreads.c)
target_link_libraries(epoll-server-multithreads yolanda)
发现多了一个rt, cmake不太熟, 是误操作, 还是特殊意义的呢?😂发现这个rt还是单独提交的
环境:CentOS7
操作过程:下载git项目后,直接在yolanda/chap-4下先执行cmake ./,然后再执行make,报以下错误:
[root@vm-centos chap-4]# make
[ 50%] Linking C executable make_socket
/usr/bin/ld: cannot find -lyolanda
collect2: error: ld returned 1 exit status
make[2]: *** [make_socket] Error 1
make[1]: *** [CMakeFiles/make_socket.dir/all] Error 2
make: *** [all] Error 2
[ 96%] Linking C executable ../bin/aio01
CMakeFiles/aio01.dir/aio01.c.o: In function main': aio01.c:(.text+0x175): undefined reference to
aio_write'
aio01.c:(.text+0x1c9): undefined reference to aio_error' aio01.c:(.text+0x1dd): undefined reference to
aio_error'
aio01.c:(.text+0x1ef): undefined reference to aio_return' aio01.c:(.text+0x2d9): undefined reference to
aio_read'
aio01.c:(.text+0x321): undefined reference to aio_error' aio01.c:(.text+0x335): undefined reference to
aio_return'
collect2: error: ld returned 1 exit status
channel_map中元素的空间大小是与fd的值正相关的,而不是跟当前在线的连接数量正相关,这样做是不是有点浪费内存?
int event_loop_handle_pending_add(struct event_loop *eventLoop, int fd, struct channel *channel) {
.......
if (fd >= map->nentries) {
if (map_make_space(map, fd, sizeof(struct channel *)) == -1)
return (-1);
}
.....
}
int map_make_space(struct channel_map *map, int slot, int msize) {
if (map->nentries <= slot) {
....
while (nentries <= slot)
nentries <<= 1;
// 这里申请的内存空间与fd的值正相关
tmp = (void **) realloc(map->entries, nentries * msize);
.......
}
....
}
yolanda/chap-7/unixdataserver.c
line 36, 59 sockadd -> sockaddr
if (recvfrom(socket_fd, buf, BUFFER_SIZE, 0, (struct sockadd *) &client_addr, &client_len) == 0) {
printf("client quit");
break;
}
printf("Receive: %s \n", buf);
char send_line[MAXLINE];
bzero(send_line, MAXLINE);
sprintf(send_line, "Hi, %s", buf);
size_t nbytes = strlen(send_line);
printf("now sending: %s \n", send_line);
if (sendto(socket_fd, send_line, nbytes, 0, (struct sockadd *) &client_addr, client_len) != nbytes)
tcp_connection.c中在处理tcp连接关闭时,未关闭fd
int handle_connection_closed(struct tcp_connection *tcpConnection) {
struct event_loop *eventLoop = tcpConnection->eventLoop;
struct channel *channel = tcpConnection->channel;
event_loop_remove_channel_event(eventLoop, channel->fd, channel);
if (tcpConnection->connectionClosedCallBack != NULL) {
tcpConnection->connectionClosedCallBack(tcpConnection);
}
}
老师请问下lib/common.h 中包含的config.h在哪里?git项目中并没有找到该文件。能否提供一下
前面的代码都运行过,没有问题。但是最后一讲的代码执行出现 Segmentation fault (core dumped)。
我是如此运行的:
./http_server01
[msg] set epoll as dispatcher, main thread
[msg] add channel fd == 5, main thread
[msg] add channel fd == 6, main thread
[msg] event loop run, main thread
然后,无论是在浏览器还是在另一个终端尝试连接:
curl -v http://127.0.0.1:43211/
服务器端出现了 Segmentation fault (core dumped)
[msg] set epoll as dispatcher, main thread
[msg] add channel fd == 5, main thread
[msg] add channel fd == 6, main thread
[msg] event loop run, main thread
[msg] epoll_wait wakeup, main thread
[msg] get message channel fd==6 for read, main thread
[msg] activate channel fd == 6, revents=2, main thread
[msg] new connection established, socket == 7
[msg] connection completed
[msg] add channel fd == 7, main thread
[msg] epoll_wait wakeup, main thread
[msg] get message channel fd==7 for read, main thread
[msg] activate channel fd == 7, revents=2, main thread
[msg] get message from tcp connection connection-7
Segmentation fault (core dumped)
这时 客户端是:
Trying 127.0.0.1...
GET / HTTP/1.1
Host: 127.0.0.1:43211
User-Agent: curl/7.58.0
Accept: /
lifemm@LAPTOP-DDUIA1AS:/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/build$ make
Scanning dependencies of target lifemm
[ 6%] Building C object lib/CMakeFiles/lifemm.dir/acceptor1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/acceptor1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/acceptor1.c:2:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.h:6:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:15,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/acceptor1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/acceptor1.c:2:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:13:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void *(*init)(struct event_loop * eventloop);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:16:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*add)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:19:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*del)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:22:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*update)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:59: warning: ‘struct timeval’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:28: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:28:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void (*clear)(struct event_loop *eventloop);
^~~~~~~~~~
[ 13%] Building C object lib/CMakeFiles/lifemm.dir/buffer1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/buffer1.c:2:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.h:6:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:15,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/buffer1.c:2:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:13:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void *(*init)(struct event_loop * eventloop);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:16:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*add)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:19:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*del)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:22:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*update)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:59: warning: ‘struct timeval’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:28: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:28:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void (*clear)(struct event_loop *eventloop);
^~~~~~~~~~
[ 20%] Building C object lib/CMakeFiles/lifemm.dir/channel1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.c:1:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.h:6:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:15,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.c:1:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:13:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void *(*init)(struct event_loop * eventloop);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:16:54: warning: ‘struct channel’ declared inside parameter list will not be visible outside of this definition or declaration
int (*add)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:16:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*add)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:19:54: warning: ‘struct channel’ declared inside parameter list will not be visible outside of this definition or declaration
int (*del)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:19:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*del)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:22:57: warning: ‘struct channel’ declared inside parameter list will not be visible outside of this definition or declaration
int (*update)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:22:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*update)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:59: warning: ‘struct timeval’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:28: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:28:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void (*clear)(struct event_loop *eventloop);
^~~~~~~~~~
[ 26%] Building C object lib/CMakeFiles/lifemm.dir/channel_map1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel_map1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel_map1.c:2:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.h:6:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:15,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel_map1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel_map1.c:2:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:13:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void *(*init)(struct event_loop * eventloop);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:16:54: warning: ‘struct channel’ declared inside parameter list will not be visible outside of this definition or declaration
int (*add)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:16:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*add)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:19:54: warning: ‘struct channel’ declared inside parameter list will not be visible outside of this definition or declaration
int (*del)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:19:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*del)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:22:57: warning: ‘struct channel’ declared inside parameter list will not be visible outside of this definition or declaration
int (*update)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:22:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*update)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:59: warning: ‘struct timeval’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:28: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:28:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void (*clear)(struct event_loop *eventloop);
^~~~~~~~~~
[ 33%] Building C object lib/CMakeFiles/lifemm.dir/epoll_dispatcher1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/epoll_dispatcher1.c:2:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
[ 40%] Building C object lib/CMakeFiles/lifemm.dir/event_loop1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.h:5,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.c:2:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.c: In function ‘event_loop_run’:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.c:245:43: warning: initialization discards ‘
const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
struct event_dispatcher *dispatcher = eventLoop->eventDispatcher;
^~~~~~~~~
[ 46%] Building C object lib/CMakeFiles/lifemm.dir/event_loop_thread1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.h:5,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop_thread1.c:4:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
[ 53%] Building C object lib/CMakeFiles/lifemm.dir/poll_dispatcher1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/poll_dispatcher1.c:1:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
[ 60%] Building C object lib/CMakeFiles/lifemm.dir/tcp_connection1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.h:5,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:1:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c: In function ‘handle_connection_close
’:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:10:49: warning: passing argument 1 of ‘tcpConnection->connectionClosedCallBack’ from incompatible pointer type [-Wincompatible-pointer-types]
tcpConnection->connectionClosedCallBack(tcpConnection);
^~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:10:49: note: expected ‘struct tcp_connection *’ but argument is of type ‘struct tcp_connection *’
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c: In function ‘handle_read’:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:22:44: warning: passing argument 1 of ‘tcpConnection->messageCallBack’ from incompatible pointer type [-Wincompatible-pointer-types]
tcpConnection->messageCallBack(input_buffer, tcpConnection);
^~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:22:44: note: expected ‘struct buffer
’ but argument is of type ‘struct buffer *’
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:22:58: warning: passing argument 2 of ‘tcpConnection->messageCallBack’ from incompatible pointer type [-Wincompatible-pointer-types]
tcpConnection->messageCallBack(input_buffer, tcpConnection);
^~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:22:58: note: expected ‘struct tcp_connection *’ but argument is of type ‘struct tcp_connection *’
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c: In function ‘handle_write’:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:50:51: warning: passing argument 1 of ‘tcpConnection->writeCompletedCallBack’ from incompatible pointer type [-Wincompatible-pointer-types]
tcpConnection->writeCompletedCallBack(tcpConnection);
^~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:50:51: note: expected ‘struct tcp_connection *’ but argument is of type ‘struct tcp_connection *’
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c: In function ‘tcp_connection_new’:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:73:31: warning: format ‘%d’ expects a matching ‘int’ argument [-Wformat=]
sprintf(buf, "connection-%d\0");//to buf
^
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:73:32: warning: embedded ‘\0’ in format [-Wformat-contains-nul]
sprintf(buf, "connection-%d\0");//to buf
^
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:81:52: warning: passing argument 1 of ‘tcpConnection->connectionCompletedCallBack’ from incompatible pointer type [-Wincompatible-pointer-types]
tcpConnection->connectionCompletedCallBack(tcpConnection);
^~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_connection1.c:81:52: note: expected ‘struct tcp_connection *’ but argument is of type ‘struct tcp_connection *’
[ 66%] Building C object lib/CMakeFiles/lifemm.dir/tcp_server1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.c:2:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.h:6:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:15,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.c:2:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:13:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void *(*init)(struct event_loop * eventloop);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:16:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*add)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:19:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*del)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:22:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*update)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:59: warning: ‘struct timeval’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:28: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:28:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void (*clear)(struct event_loop *eventloop);
^~~~~~~~~~
[ 73%] Building C object lib/CMakeFiles/lifemm.dir/thread_pool1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.h:5,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/utils1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/thread_pool1.c:2:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
[ 80%] Building C object lib/CMakeFiles/lifemm.dir/utils1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/channel1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.h:5,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/utils1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/utils1.c:1:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
[ 86%] Linking C static library liblifemm.a
[ 86%] Built target lifemm
Scanning dependencies of target poll-server-onethread1
[ 93%] Building C object cp-27/CMakeFiles/poll-server-onethread1.dir/poll-server-onethread1.c.o
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/acceptor1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/cp-27/poll-server-onethread1.c:1:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:5:54: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:64: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:7:41: warning: ‘struct buffer’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*message_call_back)(struct buffer *buffer, struct tcp_connection *tcpConnection);
^~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:9:49: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*write_completed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:11:51: warning: ‘struct tcp_connection’ declared inside parameter list will not be visible outside of this definition or declaration
typedef int (*connection_closed_call_back)(struct tcp_connection *tcpConnection);
^~~~~~~~~~~~~~
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop1.h:6:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:15,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/acceptor1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/cp-27/poll-server-onethread1.c:1:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:13:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void *(*init)(struct event_loop * eventloop);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:16:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*add)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:19:23: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*del)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:22:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*update)(struct event_loop * eventloop, struct channel * channel);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:59: warning: ‘struct timeval’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:25:28: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
int (*dispatch)(struct event_loop * eventloop, struct timeval *);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_dispatcher1.h:28:26: warning: ‘struct event_loop’ declared inside parameter list will not be visible outside of this definition or declaration
void (*clear)(struct event_loop *eventloop);
^~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/cp-27/poll-server-onethread1.c: In function ‘main’:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/cp-27/poll-server-onethread1.c:61:72: warning: passing argument 3 of ‘tcp_server_init’ from incompatible pointer type [-Wincompatible-pointer-types]
struct TCPserver tcpServer = tcp_server_init(eventLoop, acceptor, onConnectionCompleted, onMessage,
^~~~~~~~~~~~~~~~~~~~~
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/acceptor1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/cp-27/poll-server-onethread1.c:1:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:36:1: note: expected ‘connection_completed_call_back {aka int ()(struct tcp_connection )}’ but argument is of type ‘int ()(struct tcp_connection *)’
tcp_server_init(struct event_loop *eventLoop, struct acceptor *acceptor,
^~~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/cp-27/poll-server-onethread1.c:61:95: warning: passing argument 4 of ‘tcp_server_init’ from incompatible pointer type [-Wincompatible-pointer-types]
struct TCPserver tcpServer = tcp_server_init(eventLoop, acceptor, onConnectionCompleted, onMessage,
^~~~~~~~~
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/acceptor1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/cp-27/poll-server-onethread1.c:1:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:36:1: note: expected ‘message_call_back {aka int ()(struct buffer *, struct tcp_connection )}’ but argument is of type ‘int ()(struct buffer *, struct tcp_connection *)’
tcp_server_init(struct event_loop *eventLoop, struct acceptor acceptor,
^~~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/cp-27/poll-server-onethread1.c:62:53: warning: passing argument 5 of ‘tcp_server_init’ from incompatible pointer type [-Wincompatible-pointer-types]
onWriteCompleted, onConnectionClosed,0);
^~~~~~~~~~~~~~~~
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/acceptor1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/cp-27/poll-server-onethread1.c:1:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:36:1: note: expected ‘write_completed_call_back {aka int ()(struct tcp_connection )}’ but argument is of type ‘int ()(struct tcp_connection *)’
tcp_server_init(struct event_loop *eventLoop, struct acceptor acceptor,
^~~~~~~~~~~~~~~
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/cp-27/poll-server-onethread1.c:62:71: warning: passing argument 6 of ‘tcp_server_init’ from incompatible pointer type [-Wincompatible-pointer-types]
onWriteCompleted, onConnectionClosed,0);
^~~~~~~~~~~~~~~~~~
In file included from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/common1.h:4:0,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/acceptor1.h:4,
from /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/cp-27/poll-server-onethread1.c:1:
/mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/tcp_server1.h:36:1: note: expected ‘connection_closed_call_back {aka int ()(struct tcp_connection )}’ but argument is of type ‘int ()(struct tcp_connection *)’
tcp_server_init(struct event_loop *eventLoop, struct acceptor *acceptor,
^~~~~~~~~~~~~~~
[100%] Linking C executable ../bin/poll-server-onethread1
../lib/liblifemm.a(event_loop_thread1.c.o): In function event_loop_thread_start': /mnt/c/Users/lenovo/Desktop/极客时间_网络编程/lit_reactor/lib/event_loop_thread1.c:41: undefined reference to
pthread_create'
collect2: error: ld returned 1 exit status
cp-27/CMakeFiles/poll-server-onethread1.dir/build.make:95: recipe for target 'bin/poll-server-onethread1' failed
make[2]: *** [bin/poll-server-onethread1] Error 1
CMakeFiles/Makefile2:140: recipe for target 'cp-27/CMakeFiles/poll-server-onethread1.dir/all' failed
make[1]: *** [cp-27/CMakeFiles/poll-server-onethread1.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2
老师你好,请问服务端跑起来后,如何测试这个http server的性能,以确定能同时支持10k的并发呢?
ubuntu@VM-16-17-ubuntu:~/code/yolanda-master/build/bin$ ./http_server01
[msg] set epoll as dispatcher, main thread
[msg] add channel fd == 5, main thread
[msg] set epoll as dispatcher, Thread-1
[msg] add channel fd == 9, Thread-1
[msg] event loop thread init and signal, Thread-1
[msg] event loop run, Thread-1
[msg] event loop thread started, Thread-1
[msg] set epoll as dispatcher, Thread-2
[msg] add channel fd == 12, Thread-2
[msg] event loop thread init and signal, Thread-2
[msg] event loop run, Thread-2
[msg] event loop thread started, Thread-2
[msg] add channel fd == 6, main thread
[msg] event loop run, main thread
[msg] epoll_wait wakeup, main thread
[msg] get message channel fd==6 for read, main thread
[msg] activate channel fd == 6, revents=2, main thread
[msg] new connection established, socket == 13
[msg] connection completed
[msg] epoll_wait wakeup, Thread-1
[msg] get message channel fd==9 for read, Thread-1
[msg] activate channel fd == 9, revents=2, Thread-1
[msg] wakeup, Thread-1
[msg] add channel fd == 13, Thread-1
[msg] epoll_wait wakeup, main thread
[msg] get message channel fd==6 for read, main thread
[msg] activate channel fd == 6, revents=2, main thread
[msg] new connection established, socket == 14
[msg] connection completed
[msg] epoll_wait wakeup, Thread-2
[msg] get message channel fd==12 for read, Thread-2
[msg] activate channel fd == 12, revents=2, Thread-2
[msg] wakeup, Thread-2
[msg] add channel fd == 14, Thread-2
[msg] epoll_wait wakeup, Thread-1
[msg] get message channel fd==13 for read, Thread-1
[msg] activate channel fd == 13, revents=2, Thread-1
[msg] get message from tcp connection connection-13
Segmentation fault (core dumped)
老师请教一下,在reactor事件模型的代码中,buffer的内存是由谁管理(即由谁来释放分配的内存)?还有TCP连接的关闭后内存释放应在哪处理?
按照 README 说明 clone 代码,在 build 路径执行 cmake .. 后执行 make 显示链接错误:
[ 97%] Linking C executable ../bin/aio01
/usr/bin/ld: CMakeFiles/aio01.dir/aio01.c.o: in function main': aio01.c:(.text+0x1e9): undefined reference to
aio_write'
/usr/bin/ld: aio01.c:(.text+0x242): undefined reference to aio_error' /usr/bin/ld: aio01.c:(.text+0x256): undefined reference to
aio_error'
/usr/bin/ld: aio01.c:(.text+0x26b): undefined reference to aio_return' /usr/bin/ld: aio01.c:(.text+0x3c8): undefined reference to
aio_read'
/usr/bin/ld: aio01.c:(.text+0x418): undefined reference to aio_error' /usr/bin/ld: aio01.c:(.text+0x42c): undefined reference to
aio_return'
collect2: error: ld returned 1 exit status
make[2]: *** [chap-30/CMakeFiles/aio01.dir/build.make:85:bin/aio01] 错误 1
make[1]: *** [CMakeFiles/Makefile2:1917:chap-30/CMakeFiles/aio01.dir/all] 错误 2
make: *** [Makefile:130:all] 错误 2
解决方法是:
在 chap-30 的CMakeLists.txt 中添加:
target_link_libraries(aio01 rt)
/root/yolanda/lib/event_dispatcher.h:27:26: 警告:‘struct event_loop’在形参表内部声明 [默认启用]
void (*clear)(struct event_loop * eventLoop);
^
[ 97%] Linking C executable ../bin/aio01
CMakeFiles/aio01.dir/aio01.c.o:在函数‘main’中:
aio01.c:(.text+0x175):对‘aio_write’未定义的引用
aio01.c:(.text+0x1c9):对‘aio_error’未定义的引用
aio01.c:(.text+0x1dd):对‘aio_error’未定义的引用
aio01.c:(.text+0x1ef):对‘aio_return’未定义的引用
aio01.c:(.text+0x2d9):对‘aio_read’未定义的引用
aio01.c:(.text+0x321):对‘aio_error’未定义的引用
aio01.c:(.text+0x335):对‘aio_return’未定义的引用
collect2: 错误:ld 返回 1
make[2]: *** [bin/aio01] 错误 1
make[1]: *** [chap-30/CMakeFiles/aio01.dir/all] 错误 2
make: *** [all] 错误 2
[root build]#ll -lt
已经yum安装过aio和aio-dev,有没有遇到的,怎么解决的?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.