如何在Visual Studio中包括OpenSSL [英] How to include OpenSSL in Visual Studio

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

问题描述

我很难尝试将openssl添加到我的项目中.我已经下载了用于Windows的预编译安装程序,并且已经安装了库,但是找不到在项目中包含openssl的方法.

I am having a hard time trying to add openssl to my project. I have downloaded the precompiled installer for windows, and I have the libraries installed, but I can't find a way to include openssl in my project.

注意:我在Windows 7 x64上使用Visual Studio Expres 2012,但不限于该环境.

Note: I am using Visual Studio Expres 2012 on Windows 7 x64, but it's not restricted to that environment.

推荐答案

简介

  • Where to search for libraries. You can do that by going to your "Project Properties -> Linker -> General -> Additional Library Directories" and adding %OPENSSL_INSTALL_DIR%\lib (again, if there are multiple paths, separate them by ;)

要使用的库. "%OPENSSL_INSTALL_DIR%\ lib " dir 包含一堆 .lib 文件.其中,您(最有可能)仅需要 $ {LIBCRYPTO} .lib 和/或 $ {LIBSSL} .lib .转到"项目属性->链接器->输入->其他依赖项",然后将这2个库添加到现有库的旁边

What libraries to use. "%OPENSSL_INSTALL_DIR%\lib" dir contains a bunch of .lib files. Out of those, you will (most likely) only need ${LIBCRYPTO}.lib and / or ${LIBSSL}.lib. Go to your "Project Properties -> Linker -> Input -> Additional Dependencies" and add those 2 libraries next to the existing ones

现在,如果所有设置和源代码正确,那么您应该有一个可构建"项目.当您要运行您的项目输出(另一个可执行文件所需的 .exe .dll )时,我不在这里讨论如果您使用的是 static lib s),则可执行文件将需要找到我在开始时提到的2个 .dll .为此,您应该任一:

Now, if all your settings and source code are correct, you should have a "buildable" project. When you'll want to run your project output (either an .exe or a .dll needed by another executable, I am not discussing here the possibility of you are using the static libs), the executable will need to find the 2 .dlls that I mentioned at the beginning. For that, you should either:

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