未解析的符号openSSL

时间:2017-10-03 17:08:36

标签: c++ visual-studio ssl compilation

我正在尝试使用MSVC 2017编译c ++程序。

我使用来自http://slproweb.com/products/Win32OpenSSL.html的prebuild win32 openssl,因为很多相关的堆栈溢出问题都说它有效。

主要的SSL相关行:

#include <openssl/ssl.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
SSL_load_error_strings();
SSL_library_init();
OpenSSL_add_all_algorithms();

当我使用MSVC 2017构建时,错误列表包含:

LNK 2019 unresolved external symbol _OPENSSL_init_crypto referenced in main function

5次(对于不同的符号,包括init ssl,aes加密,aes解密cbc加密)。

设置

我使用x86调试设置进行编译(如果我使用发布模式,则会出现相同的错误)。

库路径在MSVC设置中设置为C:/ openssl / lib和C:/ openssl / lib / VC(VC ++库路径和链接器通用库路径)。

在VC ++设置中将包含路径设置为C:/ openssl / include。

代码生成中的运行时库设置设置为MTd。

然后我尝试了什么

This post和其他帖子说在链接器 - >条目中添加.lib文件名称其他依赖项修复了它。所以我将libcrypto.lib和libssl.lib添加到链接器条目。新的错误消息:

Error   LNK1181 impossible to open file in  entry 'libcrypto.lib libssl.lib'    cpp_spider_client   C:\Users\Nano\Documents\cpp_spider\LINK 1   

我把libcrypto.lib和libssl.lib作为菜单中的一个文件。这就是为什么它没有奏效。

0 个答案:

没有答案