Important: Please read the Qt Code of Conduct -

QT and OPENSSL compilation undefined reference

  • I have a code using openssl libraries.

    #include <openssl/aes.h>
    #include <openssl/rsa.h>
    #include <openssl/pem.h>

    and when compiling i have an error undefined reference to PEM_read_RSAPrivateKey

    in my .pro file

    QT += core gui network

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = thread
    TEMPLATE = app

    SOURCES += main.cpp

    HEADERS += mainwindow.h

    FORMS += mainwindow.ui

    Im running qt creator 3.5.1 and ubuntu 14.04.

    I've been searching since yesterday and i cant find a solution. Hoping someone will help! Thank you! Btw, im just new to qt and still exploring things.

  • Lifetime Qt Champion

    @janlei0524 You're not linking against the openSSL libraries.
    You need something like this in your pro file:

    LIBS += -L/path/to/the/lib/dir -lopenssllib

  • LIBS += -L/usr/lib -lssl -lcrypto

    solved my problem. Thanks for the reply :D

Log in to reply