1)解压libevent到F:\libevent\libevent-2.0.21-stable
(2)打开Microsoft visual studio 2010命令行工具
(3)修改以下三个文件,添加宏定义:
在以下3个文件开头添加“#define _WIN32_WINNT 0x0500”
libevent-2.0.21-stable\event_iocp.c
libevent-2.0.21-stable\evthread_win32.c
libevent-2.0.21-stable\listener.c
(4)使用VS命令提示工具编译(这里注意64位还是32位):
cd/d F:\libevent\libevent-2.0.21-stable
nmake /f Makefile.nmake
编译会出现以下错误:
.. fatal error U1073: don't know how to make 'print-winsock-errors.obj'
解决方法:
把 test/Makefile.nmake 文件删除或者以下行注释:
# print-winsock-errors.obj# print-winsock-errors.exe #print-winsock-errors.exe: print-winsock-errors.obj # $(CC) $(CFLAGS) $(LIBS) print-winsock-errors.obj