在Visual Studio 2012中使用OpenSSL [英] using OpenSSL in Visual Studio 2012

查看:103
本文介绍了在Visual Studio 2012中使用OpenSSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从 http://www.openssl.org/source/下载了Openssl的最新发行版.

我想在Visual Studio 2012中使用它,尤其是获取文件的md5/sha-1哈希,但是我无法使用openssl库包含/设置环境.老实说,我对包含的内容和位置感到困惑,但是我已经阅读了README-s.

I would like to use it in Visual Studio 2012, especially getting the md5/sha-1 hash of a file, but I can not include / setup the environment with the openssl library. To be honest I got confused what to include, and where, however I have read the README-s.

我收到此错误.

Error   1   error LNK2019: unresolved external symbol _MD5_Init referenced in function _main

所以我的问题是,我已经下载了最新版本(openssl-1.0.1e.tar.gz),我应该在VS2012中进行哪些配置才能使用该库?谢谢!

So my question is, I have downloaded the latest release (openssl-1.0.1e.tar.gz), what should I config in VS2012 to be able to use the lib? Thanks!

更新

这个问题也帮助我找到了解决方案. 使用Visual Studio 2010和OpenSSL增强SSL

This question helped me also in finding the solution. Boost SSL with Visual Studio 2010 and OpenSSL

将openSSL库与VS2012一起使用所需的步骤:

The steps required to use the openSSL lib with VS2012:

  • download and install a version (I have 64bit OS, however I installed 32bit openssl) from http://slproweb.com/products/Win32OpenSSL.html.
  • New project in VS, then Configuration Properties/C/C++/General/Additional Include Directories: openssl include folder (C:\OpenSSL-Win32\include)
  • Linker/General/Additional Library Directiories: C:\OpenSSL-Win32\lib
  • Linker/Input/Additional Dependencies :

libeay32.lib libeay32MTd.lib libeay32MT.lib libeay32MDd.lib libeay32MD.lib ssleay32.lib ssleay32MTd.lib ssleay32MT.lib ssleay32MDd.lib ssleay32MD.lib

libeay32.lib libeay32MTd.lib libeay32MT.lib libeay32MDd.lib libeay32MD.lib ssleay32.lib ssleay32MTd.lib ssleay32MT.lib ssleay32MDd.lib ssleay32MD.lib

(据写,我只需要添加一个与C/C ++/代码生成/运行时库匹配的代码,但是它可以这样工作.)

(It was written that I need to only add that one which matches with C/C++/Code Generation/Runtime Library, but It works me this way.)

  • 将这些文件复制到当前VS文件夹/VC/lib

推荐答案

您使用什么编译器来编译OpenSSL?您使用MinGW了吗?如果是这样,请确保您不剥离它们(或仅使用--strip-sneeded),否则导入符号将被剥离.标头和lib版本是否匹配?

What compiler did you use to compile OpenSSL? Did you use MinGW? If so, make sure you don't strip them (or just with --strip-unneeded) otherwise import symbols will be stripped. Do the header and lib version match?

也许您想尝试以下方式的预构建版本: http://slproweb.com/products/Win32OpenSSL. html 这些可以肯定地工作.

Maybe you want to try pre built ones from: http://slproweb.com/products/Win32OpenSSL.html those work for sure.

这篇关于在Visual Studio 2012中使用OpenSSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆