将openssl链接到visual studio 2013 LNK2019

linking openssl to visual studio 2013 LNK2019

本文关键字:studio 2013 LNK2019 visual openssl 链接      更新时间:2023-10-16

我正在visual studio 2013应用程序上进行开发,因此我需要包含openssl库。

到目前为止我做了什么:

  • 我从这里下载了VS2013 openssl-1.0.1l-VS2013.7z的预编译openssl库:http://www.npcglib.org/~stathis/blog/precompiled-openssl/(最新稳定条目MSVC2013)

  • included openssl的include目录到C/C++/General/Additional include目录

  • lib64/libeay32MTd.liblib64/ssleay32MTd.lib添加到链接器/输入/附加依赖

  • 我这样调用openssl头:#include <opensslpem.h>(例如)

我在64位Windows主机上使用VS2013,带有多线程运行库(/MTd)。每次我想构建我的项目时,它都会给我以下错误:

错误LNK2019:函数"__catch$"中的Verweis auf不包含aufgelöstes外部符号"_BIO_new_mem_buf"?decrypt@cipherEngine@@QAE?AV$basic_string@DU$char_traits@D@std@@V$allocator@D@2@@std@@PADH@Z$4".

错误LNK2019:函数"__catch$"中的Verweis auf nicht aufgelöstes外部符号"_RSA_private_decrypt"?decrypt@cipherEngine@@QAE?AV$basic_string@DU$char_traits@D@std@@V$allocator@D@2@@std@@PADH@Z$4".

错误LNK2019:函数中的Verweis auf nicht aufgelöstes externates Symbol"_PEM_read_bio_RSAPrivateKey"__catch$?decrypt@cipherEngine@@QAE?AV$basic_string@DU$char_traits@D@std@@V$allocator@D@2@@std@@PADH@Z$4".

错误LNK2019:Verweis auf nicht aufgelöstes externals Symbol"public:class std::basic_string,class std::allocater>__thiscall cipherEngine::rsaPrivateDecrypt?rsaPrivateDecrypt@cipherEngine@@QAE?AV$basic_string@DU$char_traits@D@std@@V$allocator@D@2@@std@@V23@@Z)"在函数"public:bool __thiscall cipherEngine::alterKey(class std::basic_string,class std:::allocater>)"(?alterKey@cipherEngine@@QAE_NV$basic_string@DU$char_traits@D@std@@V$allocator@D@2@@std@@@Z)"。

致命错误LNK1120:4 nicht aufgelöste Externe

谁知道"缺失的环节"?

在向VS添加外部库时,我通常会尝试包含库源代码,并在自己的树中构建它们。这避免了我认为您看到的问题,即预编译库的编译选项与主项目略有不同。不同的选项会使库无法使用。

如果您真的不想在项目中编译lib,请尝试进一步研究这些符号,以确定编译变体。

我忘了定义rsaPrivateDecrypt所属的类(真遗憾)。第二件事是使用32位库,而不是64位库。