Important: Please read the Qt Code of Conduct -

Linking openssl with QT msvc 2017

  • I am trying to link openssl with QT so I can use QSslSocket, and its honestly driving me crazy because I keep getting the error that its not linked by checking QSslSocket::supportsSsl();

    After I added the lib in my .pro file I ran it against Dependency Walker and it doesn't even look like its being required to link.
    I checked QSslSocket::sslLibraryBuildVersionString() and it wants openssl 1.0.2j but I couldn't find that so I downloaded openssl 1.0.2l msvc 2017.


    QT       += core gui network
    LIBS += -L"C:\\Users\\Trevin Corkery\\Desktop\\openssl-1.0.2l-vs2017\\lib64\\" -llibeay32MD
    LIBS += -L"C:\\Users\\Trevin Corkery\\Desktop\\openssl-1.0.2l-vs2017\\lib64\\" -lssleay32MD
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    TARGET = Login_Portal
    TEMPLATE = app
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked as deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    SOURCES += \
            main.cpp \
    HEADERS += \
    FORMS += \

    Files included with .exe:

    But I still get the error of: QSslSocket: cannot call unresolved function SSLv23_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 QSslSocket: cannot call unresolved function ERR_get_error

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    There's not use linking your application to these libraries. The default build of Qt dlopens them at runtime. You just have to make them available like you did beside your application. However, AFAIK, the MD suffix is likely wreaking havoc. IIRC, it should only be ssleay32.dll and the same for the other .dll.

Log in to reply