C++ VS2015编译libevent静态库 x64

场景描述:

环境:VS2015,libevent

libevent下载地址:https://github.com/libevent/libevent/archive/master.zip

 

操作步骤:

1.下载libevent,解压到C:\Users\Administrator\Desktop\libevent\libevent-master

2.打开vs2015 x64命令:

输入命令:cd /d C:\Users\Administrator\Desktop\libevent\libevent-master     回车

输入命令:nmake /f Makefile.nmake

等待1~2分钟,静态库编译完成。

3.提取静态库。

新建文件夹路径为:C:\Users\Administrator\Desktop\libevent\Third_Part,Third_Part中新建include,lib文件夹。

include文件夹包含:

(1)C:\Users\Administrator\Desktop\libevent\libevent-master\include下有event2文件夹其他.h文件,拷贝到include.

(2)C:\Users\Administrator\Desktop\libevent\libevent-master\WIN32-Code\*下有nmake文件夹其他.h,.c文件

其他.h,.c文件拷贝到include,  *\nmake\event2\event-config.h拷贝到include\event2,*\nmake\evconfig-private.h拷贝到include

(3)C:\Users\Administrator\Desktop\libevent\libevent-master\*.h 拷贝到include

lib文件夹包含:

C:\Users\Administrator\Desktop\libevent\libevent-master\  libevent.lib,libevent_core.lib,libevent_extras.lib三个文件.

4.使用静态库

打开vs2015,新建项目,配置平台为x64,配置属性:

(1)附加包含目录,指向include

(2)附加库目录,指向lib

(3)附件依赖项,添加 ws2_32.lib wsock32.lib libevent.lib libevent_core.lib libevent_extras.lib

编译运行成功。

 

参考链接:https://www.cnblogs.com/kuliuheng/p/3978951.html

Demo地址:https://download.csdn.net/download/qq_30722721/11015199

 

 

 

 

 

 

 

已标记关键词 清除标记
相关推荐
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页