缺少 Qt SSL 支持 [英] Qt SSL support missing

查看:91
本文介绍了缺少 Qt SSL 支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚下载了 Qt(LGPL - Qt SDK for Windows),当我运行一些演示时,他们抱怨 Qt 没有 SSL.
如何获得启用了 SSL 的 Qt SDK?我真的需要从源代码编译它以获得 SSL 支持吗?为什么我下载的版本没有它?

I've just downloaded Qt (LGPL - Qt SDK for Windows) and when i run some of the demos they complain about Qt not having SSL.
How can i get the Qt SDK with SSL enabled? Do i really need to compile it from source to get SSL support? Why is it missing in the version i've downloaded?

推荐答案

@user261882 答案只是部分正确.他说 Qt 不支持 SSL 是正确的,您确实需要下载 OpenSSL 库.

@user261882 answer is only partially correct. He is correct in saying that Qt does not come with SSL support and that you do need to download the OpenSSL libraries.

但是,后面的链接过程要简单得多,您无需在下载 SSL 库后重新构建 Qt 或使用 Microsoft Visual 的东西.Qt 让您轻松完成.

However, the linking process after is much more simple, you do not need to rebuild Qt after downloading the SSL libraries or mess around with Microsoft Visual stuff. Qt makes it easy for you.

在下载 SSL 库后,您需要做的就是确保 Qt 可以找到这些 openSSL 库所在的位置.如果您在下载过程中选择了将 openSSL DLL 复制到 Windows 的选项system 目录,Qt 将自动在该目录中查找 openSSL 二进制文件,因为 Windows 系统目录总是被 Windows 搜索.

All that you need to do after downloading the SSL libraries is ensure that Qt can find where these openSSL libraries are located. If during your download you select the option to copy the openSSL DLL's to the Windows system directory, Qt will automatically find the openSSL binaries in that directory since the Windows system directory is always searched by Windows.

如果你不想在你的 Windows 系统目录中安装 openSSL 库,那很好,你只需要告诉 Qt openSSL DLL 的位置.您可以通过多种方式执行此操作……一种可能的解决方案是设置将 openSSL DLL 的位置添加到系统路径.另一个简单的解决方案是将 openSSL DLL 复制到包含可执行文件的目录中.保证也会搜索此目录.

If you do not wish to install the openSSL libraries in your Windows system directory, that is fine, you just need to tell Qt where the openSSL DLL's are located. You can do this in a number of ways... one possible solution is setting adding the openSSL DLL's location to the system PATH. Another simple solution is to copy the openSSL DLL's into the directory which contains your executable. This directory is guaranteed to be searched as well.

一个简单的检查,您可以在之后运行以查看这是否有效,即调用静态函数 QSslSocket::supportsSsl(),如果这个函数返回true,说明Qt已经找到了你下载的openSSL二进制文件.(当然要保证你在运行此测试之前的 .pro 文件)

A simple check that you can run afterwards to see if this worked is call the static function QSslSocket::supportsSsl(), if this function returns true, Qt has found the openSSL binaries that you downloaded. (Of course ensure that you add Qt += network in your .pro file before running this test)

使用 Qt Creator 2.5.2 和 Win32 OpenSSL 库 v1.0.1c 使用 Qt 4.8.3 二进制文件进行测试

希望这能为大家节省一些时间.这样做你不需要去搜索 Visual Studio 文件,它更简单.

Hope this saves everyone some time. Doing it this way you don't need to go and search the Visual Studio files and it is much simpler.

这篇关于缺少 Qt SSL 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆