Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
390 views
in Technique[技术] by (71.8m points)

qt4 - Qt SSL support missing

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

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.

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.

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.

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)

Tested with Qt 4.8.3 binaries, using Qt Creator 2.5.2, and Win32 OpenSSL libraries v1.0.1c

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...