《Linux下编译libevent源码》讲述了linux下编译libevent源码的方法,本文讲述其在windows平台的编译。
一、下载libevent源码
https://libevent.org/ 下载libevent源码并解压。

二.安装依赖项
下载安装OpenSSL。https://slproweb.com/products/Win32OpenSSL.html

三.编译libevent源码
以管理员身份运行Visual Studio的x86本机工具命令提示符。

进入libevent源码目录,执行:
nmake /f Makefile.nmake

编译过程中可能会遇到的报错如下:
1、“uint32_max”未声明的标识符
解决方法:源码目录下的“minheap-internal.h”里面加一句“#include<stdint.h>”

2、无法解析的外部符号 if_nametoindex

解决方法:
test/Makefile.nmake 中加入Iphlpapi.lib

编译成功后,可以看到源码目录下生成了libevent.lib、libevent_extras.lib、libevent_core.lib
参考:《Libevent 学习一:Libevent 源码编译》



















