简体   繁体   中英

How to properly setup OpenSSL for Qt on Windows 10?

I've downloaded and installed OpenSSL from this link: http://slproweb.com/products/Win32OpenSSL.html

Then I added the following line to my .pro file:

LIBS += -LC:/OpenSSL-Win32/lib -llibcrypto -llibssl

I can confirm QT is able to link the libs because if I put a random letter on their name it fails the build saying that said lib was not found

Then I copied "libcrypto-1_1.dll" and "libssl-1_1.dll" from the OpenSSL bin folder to my application folder.

I added #include <QSslSocket> to my file, but when I call QSslSocket::supportsSsl() it always return false. What I'm doing wrong?

Note: I'm clearing the project between builds to assure QT is using the lastest changes

Problem solved by following this step:

The OpenSSL libraries are looked up first in the directory of the executable, then in the Windows System directory (usually C:\\Windows\\system32), and finally in all directories listed in the PATH environment variable.

Once I copied the dlls to system32 folders it started working (even though I had them on PATH variable AND executable folder)

More info can be found here: https://doc.qt.io/qt-5/windows-requirements.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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