简体   繁体   English

QSslSocket:无法调用未解析的函数

[英]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.dllssleay32.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: 补充说明:

  • Starting in Qt 5.2 you must use version 1.0.0 or newer. 从Qt 5.2开始,您必须使用1.0.0或更高版本。 0.9.8 doesn't work any more. 0.9.8不再起作用了。 (Source: http://doc.qt.io/qt-5/ssl.html ) (来源: http//doc.qt.io/qt-5/ssl.html
  • For my standard MSVC2017x64 distribution of Qt 5.10.1 sslLibraryBuildVersionString() returned "OpenSSL 1.0.2o". 对于Qt 5.10.1的标准MSVC2017x64分发, sslLibraryBuildVersionString()返回“OpenSSL 1.0.2o”。 I use 1.0.2p for my distributions. 我使用1.0.2p作为我的发行版。
  • The OpenSSL DLLs changed names to libcrypto-1_1*.dll and libssl-1_1*.dll starting in OpenSSL 1.1.0. 从OpenSSL 1.1.0开始,OpenSSL DLL将名称更改为libcrypto-1_1*.dlllibssl-1_1*.dll Standard Qt distributions don't yet use those as of Sept. 2018. 标准Qt发行版尚未使用截至2018年9月的版本。
  • OpenSSL GitHub downloads are here: https://github.com/openssl/openssl/tags OpenSSL GitHub下载在这里: https//github.com/openssl/openssl/tags

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.solibssl.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编译器一起使用:

  1. Download 1.0 version (Win64 OpenSSL v1.0.2r Light) from here: https://slproweb.com/products/Win32OpenSSL.html 从这里下载1.0版本(Win64 OpenSSL v1.0.2r Light): https//slproweb.com/products/Win32OpenSSL.html
  2. When installing, choose to copy DLLs to OpenSSL bin directory. 安装时,选择将DLL复制到OpenSSL bin目录。
  3. And then copy libeay32.dll and ssleay32.dll from OpenSSL bin folder to: {Your_Qt_Folder}/{Qt_version}/msvc2017_64/bin 然后将libeay32.dllssleay32.dll从OpenSSL bin文件夹复制到: {Your_Qt_Folder}/{Qt_version}/msvc2017_64/bin

I solved this problem. 我解决了这个问题。

  1. Download and install v1.0.2s <<--( libeay32.dll , ssleay32.dll ) at https://slproweb.com/products/Win32OpenSSL.html 下载并安装v1.0.2s << - ( libeay32.dllssleay32.dll ), 网址https://slproweb.com/products/Win32OpenSSL.html

  2. Copy libeay32.dll and ssleay32.dll 复制libeay32.dllssleay32.dll

  3. 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

  4. Paste libeay32.dll and ssleay32.dll in C:\\Qt\\Tools\\QtCreator\\bin . libeay32.dllssleay32.dll粘贴到C:\\Qt\\Tools\\QtCreator\\bin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 没有匹配的函数调用未解析的函数类型 - no matching function call unresolved function type 没有匹配的函数无法调用未解析的重载函数类型 - no matching function for call unresolved overloaded function type “没有匹配的函数可以调用...未解析的重载函数类型” - “No matching function for call to… unresolved overloaded function type” QSslSocket无法解决和权限被拒绝错误 - QSslSocket cannot resolve and Permission Denied error 没有匹配的函数可调用未解析的重载函数类型 - No matching function for call to unresolved overloaded function type 重载的电话*** <unresolved overloaded function type> )&#39;不明确 - call of overloaded *** <unresolved overloaded function type>)' is ambiguous 无法调用其他类-ERR-未解析的外部符号 - Cannot Call Another Class - ERR - Unresolved External Symbol 错误:无法转换 '<unresolved overloaded function type> '到'函数指针'</unresolved> - Error: cannot convert '<unresolved overloaded function type>' to 'function pointer' 没有匹配的函数来调用&#39;QDomDocument :: createElement( <unresolved overloaded function type> )&#39; - no matching function for call to 'QDomDocument::createElement(<unresolved overloaded function type>)' Qt SSl错误(QSslSocket:无法解析TLSv1_1_client_method) - Qt SSl Error (QSslSocket: cannot resolve TLSv1_1_client_method)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM