Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT and OPENSSL compilation undefined reference
Qt 6.11 is out! See what's new in the release blog

QT and OPENSSL compilation undefined reference

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 3.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    janlei0524
    wrote on last edited by
    #1

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

    jsulmJ 1 Reply Last reply
    0
    • J janlei0524

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

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • J Offline
        J Offline
        janlei0524
        wrote on last edited by
        #3

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

        solved my problem. Thanks for the reply :D

        1 Reply Last reply
        3

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved