1、从Libevent官网主页或者github上将libevent源码包下载,默认名称为libevent-2.1.8-stable.tar,使用7zip或其他解压工具将其解压至磁盘任意目录。
2、打开VC2017开发命令行工具(点左下角Windows图标,选在Visual Studio 2017分支,点开"Developer Commmand prompt”),打开命令行工具。
3、使用cd 命令将当前工作目录转移到刚才解压的libevent源码主目录。这个目录下包含Makefile.nmake文件,执行命令nmake /f Makefile.nmake static_libs命令,将编译产生libevent.liblibevent_core.liblibevent_extras.lib三个文件。
4、其实libevent有几个编译选项可供选择,如下All编译:nmake /f Makefile.nmake [all] //all可以省略,默认是all静态库编译: nmake /f Makefile.nmake static_libs测试程序编译:nmake /f Makefile.nmake tests清理编译输出:nmake /f Makefile.nmake clean