简体   繁体   English

使用QSslSocket时未解决的函数

[英]Unresolved Functions While Working With QSslSocket

I tried to run a simple program that is written with Qt and QSslSocket is used in. I'm running this program on a Ubuntu 12.04 machine with OpenSSL installed . 我尝试运行一个用Qt编写的简单程序,并使用QSslSocket。我在安装OpenSSL的Ubuntu 12.04机器上运行该程序。 But I got the following errors: 但是我遇到了以下错误:

QSslSocket: cannot call unresolved function SSLv3_client_method
QSslSocket: cannot call unresolved function SSL_CTX_new
QSslSocket: cannot call unresolved function SSL_library_init
QSslSocket: cannot call unresolved function ERR_get_error

How can I fix these errors ? 我该如何解决这些错误?

On Windows/MinGW you need to copy these files to your exe directory. 在Windows / MinGW上,您需要将这些文件复制到exe目录。

C:\Qt\Tools\mingw492_32\opt\bin\libeay32.dll
C:\Qt\Tools\mingw492_32\opt\bin\ssleay32.dll

Or you can copy them to C:\\Qt\\Tools\\mingw492_32\\bin if you want it to work with all your apps. 或者,如果您希望它可以与您的所有应用程序一起使用,则可以将它们复制到C:\\Qt\\Tools\\mingw492_32\\bin Obviously you need to distribute them with your program. 显然,您需要将它们与您的程序一起分发。

You actually don't need to add QT += network . 你其实并不需要增加QT += network

Install the latest openSSL version. 安装最新的openSSL版本。 yum install openssl , yum install libssl-dev. yum install opensslyum install libssl-dev. .

And add QT += network in your .pro file 并在.pro文件中添加QT + = network

Source: http://codeblog.vurdalakov.net/2009/11/solution-qsslsocket-cannot-call.html 来源: http//codeblog.vurdalakov.net/2009/11/solution-qsslsocket-cannot-call.html

I had the same problem with QT 5.0.1 and QT 5.1.1, and finally I realized I need to copy OpenSSL DLL files next to the application binary file. 我在QT 5.0.1和QT 5.1.1中遇到了同样的问题,最后我意识到我需要在应用程序二进制文件旁边复制OpenSSL DLL文件。 For some reason QT do not load the DLL files from Windows Path ... 由于某种原因,QT不从Windows路径加载DLL文件...

I've used OpenSSL Win32 0_9_8y 我使用过OpenSSL Win32 0_9_8y

For Ubuntu or (Debian based Linux) install openssl and libssl-dev 对于Ubuntu或(基于Debian的Linux),安装openssl和libssl-dev

ie sudo apt-get install openssl libssl-dev . sudo apt-get install openssl libssl-dev

For Red Hat , Fedora , CentOS (rpm based linux) install openssl and openssl-devel 对于Red Hat,Fedora,CentOS(基于rpm的linux)安装openssl和openssl-devel

ie yum install openssl openssl-devel yum install openssl openssl-devel

You need to include this file: 您需要包含此文件:

 #include <QtNetwork>

And in your .pro file, add this line: .pro文件中,添加以下行:

 QT += network

我将OpenSSL降级到版本1.0并且有效。

在debian上安装lua-openssl软件包似乎已经为我解决了这个问题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM