在VS下编译openSSL库

prepare:

 1)安装visual studio 2012

 2)安装ActivePerl, 官方网站:http://www.activestate.com/activeperl/

 3)下载openSSL源代码, 官方网站:http://www.openssl.org/source/

4) 下载nasm 解压后配置PATH  http://www.nasm.us/

编译:

 1)使用VS2012 下的Visual Studio 2012 Command Prompt进入控制台模式
 开始菜单->所有程序->Microsoft->Microsoft Visual Studio 2005->Visual Studio Tools->Visual Studio 2005 Command Prompt
 2)进入openssl源码的目录(见install.w32)
 

VC 中使用:

 C++ 常规->附加目录 中增加 你的openssl路径/openssl-0.9.8k /inc32 目录;在 链接器->常规->附加库目录  中增加 你的openssl路径/openssl-0.9.8k/out32dll 。

7 、编写 OpenSSL 程序,可参考 你的openssl路径/openssl-0.9.8k/demos

 1 )包含相应头文件

#include <openssl/***. h >

(2) 添加静态链接库

#pragma comment (lib, "libeay32.lib" )

#pragma comment (lib, "ssleay32.lib" )

 这在工程链接器->输入-> 附加依赖项中 填写 libeay32.lib ssleay32.lib 。

 3 )将动态链接库ssleay32.dll, libeay32.dll 复制到 工程识别的目录,确保动态链接库在正确的路径

posted on 2015-05-07 16:16  DuDD  阅读(593)  评论(0编辑  收藏  举报

导航