[英]QSslSocket: cannot call unresolved function
I am running Qt 5.7.1 (MSVC 2015, 32 bit) with Qt Creator 4.2.0. 我使用Qt Creator 4.2.0运行Qt 5.7.1(MSVC 2015,32位)。 I have a problem with
QSslSocket
. 我有
QSslSocket
的问题。 I am getting the following errors: 我收到以下错误:
qt.network.ssl: QSslSocket: cannot call unresolved function SSLv23_client_method
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_CTX_new
qt.network.ssl: QSslSocket: cannot call unresolved function SSL_library_init
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
qt.network.ssl: QSslSocket: cannot call unresolved function ERR_get_error
I have gone to the following location openssl github and downloaded the zip file. 我去了以下位置openssl github并下载了zip文件。 I have moved the "libeay32.dll" and "ssleay32.dll" files to my release directory, and I am still getting these errors.
我已将“libeay32.dll”和“ssleay32.dll”文件移到我的发布目录中,我仍然遇到这些错误。 Is there anyone who has gotten the
QSslSocket
working that can give me steps to get the socket working or has any suggestions? 有没有人让
QSslSocket
工作,可以给我步骤让套接字工作或有任何建议?
I ended up here via Googling around. 我最终通过谷歌搜索到了这里。 In my case, I was getting this error on random machines because they were missing the correct versions of
libeay32.dll
and ssleay32.dll
. 在我的情况下,我在随机机器上收到此错误,因为他们错过了
libeay32.dll
和ssleay32.dll
的正确版本。 It's "random" because some computers have these loaded in PATH
from other software and some do not. 它是“随机的”,因为有些计算机将这些计算机从其他软件加载到
PATH
,而有些则没有。
I fixed this for Qt Creator by adding the DLLs to the bin
folder of my Qt install, and I fixed this on distributions by including the aforementioned DLLs in my distribution. 我通过将DLL添加到我的Qt安装的
bin
文件夹中为Qt Creator修复了这个问题,并通过在我的发行版中包含上述DLL来修复此问题。
The DLLs should be the same or similar to the version of OpenSSL that Qt was compiled with in the first place. 这些DLL应该与Qt首先编译的OpenSSL版本相同或类似。 If you didn't compile it yourself, starting in Qt 5.4 you can query this with
QSslSocket::sslLibraryBuildVersionString()
. 如果您没有自己编译,从Qt 5.4开始,您可以使用
QSslSocket::sslLibraryBuildVersionString()
进行查询。 (Credit: https://stackoverflow.com/a/42297296/1666676 ) (信用: https : //stackoverflow.com/a/42297296/1666676 )
Don't forget that your 64-bit apps should have a 64-bit version of the DLLs, and 32-bit apps should have 32-bit DLLs so you don't have the same problem as this guy . 不要忘记您的64位应用程序应该具有64位版本的DLL,而32位应用程序应该具有32位DLL,因此您不会遇到与此问题相同的问题。
Additional notes: 补充说明:
sslLibraryBuildVersionString()
returned "OpenSSL 1.0.2o". sslLibraryBuildVersionString()
返回“OpenSSL 1.0.2o”。 I use 1.0.2p for my distributions. libcrypto-1_1*.dll
and libssl-1_1*.dll
starting in OpenSSL 1.1.0. libcrypto-1_1*.dll
和libssl-1_1*.dll
。 Standard Qt distributions don't yet use those as of Sept. 2018. Hope this helps the next person. 希望这有助于下一个人。 Sorry for resurrecting an old post.
抱歉复活旧帖子。
Copy these two file to path: 'C:\\Qt\\Tools(msvc/mingw){version}\\bin' 将这两个文件复制到路径:'C:\\ Qt \\ Tools(msvc / mingw){version} \\ bin'
C:\Qt\Tools\(msvc|mingw)\opt\bin\libeay32.dll
C:\Qt\Tools\(msvc|mingw)\opt\bin\ssleay32.dll
You need to Add support to OppenSSL manually, since android dropped the support of it, and i am using QT 5.9 and its not make it for you so its your mission to create openSSL lib 你需要手动添加对OppenSSL的支持,因为android放弃了对它的支持,我使用的是QT 5.9而且它不适合你,所以你的任务是创建openSSL lib
You can download it directly here https://wiki.openssl.org/index.php/Binaries 您可以直接在这里下载https://wiki.openssl.org/index.php/Binaries
or here https://indy.fulgan.com/SSL/ 或者在这里https://indy.fulgan.com/SSL/
and then copy these filed and include them to your project 然后复制这些文件并将它们包含在您的项目中
libcrypto.so
libssl.so
That should work correctly 这应该正常工作
Or you can generate your libcrypto.so
and libssl.so
using this script , just follow it step by step https://github.com/ekke/android-openssl-qt 或者您可以使用此脚本生成
libcrypto.so
和libssl.so
,只需按步骤操作https://github.com/ekke/android-openssl-qt
By combining existing answers here and some research I managed to make it work with MSVC2017 x64 compiler: 通过结合现有答案和一些研究,我设法使其与MSVC2017 x64编译器一起使用:
{Your_Qt_Folder}/{Qt_version}/msvc2017_64/bin
{Your_Qt_Folder}/{Qt_version}/msvc2017_64/bin
I solved this problem. 我解决了这个问题。
Download and install v1.0.2s <<--( libeay32.dll
, ssleay32.dll
) at https://slproweb.com/products/Win32OpenSSL.html 下载并安装v1.0.2s << - (
libeay32.dll
, ssleay32.dll
), 网址为https://slproweb.com/products/Win32OpenSSL.html
Copy libeay32.dll
and ssleay32.dll
复制
libeay32.dll
和ssleay32.dll
Find QtNetwork*.dll
in your Qt folder. 在Qt文件夹中找到
QtNetwork*.dll
。 In my case, path is C:\\Qt\\Tools\\QtCreator\\bin
. 在我的例子中,路径是
C:\\Qt\\Tools\\QtCreator\\bin
。
Paste libeay32.dll
and ssleay32.dll
in C:\\Qt\\Tools\\QtCreator\\bin
. 将
libeay32.dll
和ssleay32.dll
粘贴到C:\\Qt\\Tools\\QtCreator\\bin
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.