libev库安装:
当前版本下载:
[root@mid_server ~]# cd /usr/local/src 
[root@mid_server src]# wget http://dist.schmorp.de/libev/libev-4.20.tar.gz 
 
2.解压以及安装:
[root@mid_server src]# tar -zxvf libev-4.20.tar.gz
[root@mid_server src]# cd libev-4.20
[root@mid_server libev-4.20]# ./configure
[root@mid_server libev-4.20]# echo $?
[root@mid_server libev-4.20]# make
[root@mid_server libev-4.20]# make install
 
gcc下编译含libev库函数的c文件test.c:
[root@mid_server src]# gcc test4.c -lev
没有报错,就行。
若不加-lev:

[root@mid_server src]# gcc test4.c
/tmp/ccCIrnLe.o: In function `io_action':
test4.c:(.text+0x74): undefined reference to `ev_io_stop'
/tmp/ccCIrnLe.o: In function `main':
test4.c:(.text+0x93): undefined reference to `ev_default_loop'
test4.c:(.text+0x108): undefined reference to `ev_io_start'
test4.c:(.text+0x11c): undefined reference to `ev_run'
collect2: ld 返回 1

 
eclipse下添加需要链接的库:
Project -> Properties -> C/C++ Build -> Settings里面的Libraries -> 在Libraries(-l)里面点击+(添加按钮),写入ev,保存退出,代码就不报错了!
001.libev安装及eclipse下添加libev库链接-LMLPHP
 
04-15 11:14