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. libqrencode undefined reference error
Forum Updated to NodeBB v4.3 + New Features

libqrencode undefined reference error

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 405 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.
  • T Offline
    T Offline
    tiamat
    wrote on last edited by
    #1

    Hi guys, this is my first time posting here, I need some help with generating QR code using fukuchi qrencode library, I'm using QT 5.14 on Windows and I followed the instructions on this website to generate and implement the library

    https://www.programmerall.com/article/9877982530/

    However, when I tried to run the sample program, it gives me an undefined reference error on QRcode_encodeString and QRcode_free

    Can you guys help me?

    jsulmJ 1 Reply Last reply
    0
    • T tiamat

      Hi guys, this is my first time posting here, I need some help with generating QR code using fukuchi qrencode library, I'm using QT 5.14 on Windows and I followed the instructions on this website to generate and implement the library

      https://www.programmerall.com/article/9877982530/

      However, when I tried to run the sample program, it gives me an undefined reference error on QRcode_encodeString and QRcode_free

      Can you guys help me?

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

      @tiamat Please post the pro file. Undefined reference means that the lib is either not found or is incompatible.

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

      T 1 Reply Last reply
      0
      • T Offline
        T Offline
        tiamat
        wrote on last edited by
        #3

        Here's my .pro file

        QT       += core gui
        
        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
        
        CONFIG += c++11
        
        # The following define makes your compiler emit warnings if you use
        # any Qt feature that has been marked 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.
        DEFINES += QT_DEPRECATED_WARNINGS
        
        # You can also make your code fail to compile if it uses 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 \
            mainwindow.cpp
        
        HEADERS += \
            libqrencode/qrencode.h \
            mainwindow.h
        
        FORMS += \
            mainwindow.ui
        
        # Default rules for deployment.
        qnx: target.path = /tmp/$${TARGET}/bin
        else: unix:!android: target.path = /opt/$${TARGET}/bin
        !isEmpty(target.path): INSTALLS += target
        
        win32: LIBS += -L$$PWD/libqrencode/ -llibqrencode
        
        INCLUDEPATH += $$PWD/libqrencode
        DEPENDPATH += $$PWD/libqrencode
        
        win32:!win32-g++: PRE_TARGETDEPS += $$PWD/libqrencode/qrencode.lib
        else:win32-g++: PRE_TARGETDEPS += $$PWD/libqrencode/libqrencode.a
        
        
        1 Reply Last reply
        0
        • jsulmJ jsulm

          @tiamat Please post the pro file. Undefined reference means that the lib is either not found or is incompatible.

          T Offline
          T Offline
          tiamat
          wrote on last edited by
          #4

          @jsulm they did mention this undefined reference error in the reference part, but they don't provide any solutions to it, I've tried linking the static library using the -L -l format but to no avail

          1 Reply Last reply
          0
          • T Offline
            T Offline
            tiamat
            wrote on last edited by
            #5

            Nevermind, I solved it, I forgot to define the config as staticlib while building the qrencode library

            1 Reply Last reply
            1

            • Login

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