Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/133.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 为什么OpenSSL不能在Windows上正确链接_C++_.net_Visual Studio_Visual Studio 2013_Openssl - Fatal编程技术网

C++ 为什么OpenSSL不能在Windows上正确链接

C++ 为什么OpenSSL不能在Windows上正确链接,c++,.net,visual-studio,visual-studio-2013,openssl,C++,.net,Visual Studio,Visual Studio 2013,Openssl,我使用OpenSSL 1.1.0D来构建VisualStudio 2013中的托管C++项目。Building for Debug效果很好,但Building for Release会生成以下链接器错误: error LNK2019: unresolved external symbol _SSLv23_server_method error LNK2019: unresolved external symbol _SSLv23_client_method error LNK2019: unre

我使用OpenSSL 1.1.0D来构建VisualStudio 2013中的托管C++项目。Building for Debug效果很好,但Building for Release会生成以下链接器错误:

error LNK2019: unresolved external symbol _SSLv23_server_method
error LNK2019: unresolved external symbol _SSLv23_client_method
error LNK2019: unresolved external symbol _CRYPTO_num_locks
error LNK2019: unresolved external symbol _CRYPTO_set_locking_callback
error LNK2019: unresolved external symbol _CRYPTO_set_dynlock_create_callback
error LNK2019: unresolved external symbol _CRYPTO_set_dynlock_lock_callback
error LNK2019: unresolved external symbol _CRYPTO_set_dynlock_destroy_callback
error LNK2019: unresolved external symbol _OPENSSL_add_all_algorithms_noconf
error LNK2019: unresolved external symbol _EVP_cleanup
error LNK2019: unresolved external symbol _SSL_load_error_strings
error LNK2019: unresolved external symbol _SSL_library_init
error LNK2019: unresolved external symbol _ERR_free_strings
error LNK2019: unresolved external symbol _CONF_modules_free
error LNK2019: unresolved external symbol _sk_num
error LNK2019: unresolved external symbol _sk_value
我已经尝试使用我自己的OpenSSL构建以及来自sigmoid的预编译版本,结果是一样的

我的假设是,虽然这些OpenSSL构建与'/MD’是相同的,但仅仅是不足以与我的托管C++项目兼容。但是,由于没有从托管层直接调用OpenSLL,我的理解是使用“/MD”构建就足够了。另外,调试版本工作正常。那么,为什么仅仅是释放一个窒息呢


是什么导致这些链接器错误,以及如何解决这些错误?

您可能使用了错误的OpenSSL版本。请尝试OpenSSL v1.0.2k。它抱怨的符号不包括在1.1.x分支中


如有必要,请记住也在ws_lib32.lib和crypt32.lib中链接。

您想用OpenSSL链接什么?你自己的OpenSSL代码还是其他一些库?POCO C++库。我有自己的VS项目用于Poco,它是在CLR支持打开的情况下构建的,即使没有C代码直接调用Poco代码。我有一个C++层的包装层,封装了我所做的几个调用。这段代码已经在OpenSSL和Poco的早期版本上运行了2年多,我只是尝试将它们更新到相对最新的版本。请说明OpenSSL发布版本的位置。请显示link命令的输出。构建结果保存在中间文件夹IIRC的HTML文件中。我有构建日志,但它们非常庞大。我能帮你从他们那里弄点特别的吗?我不确定是否还有中间文件。版本生成库位于bin/lib中,而不是bin/lib64中。另外,如前所述,我尝试使用第三方构建并获得了相同的结果。我相信我们只需要两项:1说明OpenSSL发布构建的位置;和2显示link命令及其输出。我使用略新的1.1.x版本重新构建了它,它运行正常。从未发现旧版本有什么问题,但我试图使用该版本与服务器端100%兼容。稍微不同的版本并没有破坏任何东西,所以向前移动……从POCO C++的变更文件看来,他们修复了库,以在PoC+C++ V1.7.7上对OpenSSL V.1.x进行编译,也许你最初是使用了旧版本或其他东西。