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

查看:34
本文介绍了在 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 中配置什么才能使用 lib?谢谢!

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

在 VS2012 中使用 openSSL 库所需的步骤:

The steps required to use the openSSL lib with VS2012:

libeay32.lib libeay32MTd.lib libeay32MT.lib libeay32MDd.liblibeay32MD.lib ssleay32.lib ssleay32MTd.lib ssleay32MT.libssleay32MDd.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-unneeded),否则导入符号将被剥离.标头和 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天全站免登陆