解决 对‘evutil_make_socket_nonblocking’未定义的引用之类的问题。
先记录一下libevent在Ubuntu下的安装,其实也很简单:
tar zxvf libevent-2.*.*.tar.gz
cd libevent-2.*.*
./configure –prefix=/usr
make
make install
前提是去官网下载,推荐稳定版(学习或者专门找BUG除外~~)http://libevent.org/
接下来就是让eclipse在编译是链接到这个库了。需要两步:
1.Properties->c/c++ General->Paths and Symbols->Library Paths ->add ->/usr/include/event2
2.Properties->c/c++ Build -> Settings -> Gcc C++ Linker ->Libraries
然后在右侧上方 Libraries(-l) 点击那个绿色的加号,输入 event.
最后,apply.开始享受libevent带来的喜悦吧~~