Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. ZBAR and QT
Forum Updated to NodeBB v4.3 + New Features

ZBAR and QT

Scheduled Pinned Locked Moved 3rd Party Software
9 Posts 4 Posters 9.3k Views 2 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
    Jork
    wrote on last edited by
    #1

    Hi,

    i´m working on windows with QT 5.2 and MinGW. I tried to integrate the ZBAR libs into my Project by copying the files (zbar.h und the zbar folder with the other headers) into my Project folder and adding in my .pro file

    @
    HEADERS += zbar.h
    INCLUDEPATH += /zbar/
    @

    but i get these errors

    @
    In function 'ZN4zbar12ImageScannerC1EPNS_20zbar_image_scanner_sE':
    undefined reference to `zbar_image_scanner_create´
    @

    main.cpp

    @
    #include "mainwindow.h"
    #include <QApplication>
    #include <zbar.h>
    #include <QImage>

    using namespace zbar;

    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    //This is part of ZBar, just added it for testing
    ImageScanner scanner;
    
    return a.exec&#40;&#41;;
    

    }
    @

    hope somebody can help

    thanks

    1 Reply Last reply
    0
    • S Offline
      S Offline
      steno
      wrote on last edited by
      #2

      If its a library, you have to add it to LIBS += \ and add to INCLUDEPATH where the headers are. If you plan on building it, you also have to add the cpp's.

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

        Ok, i changed my .pro file in

        @
        QT += core gui

        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

        TARGET = zbar_gui_app
        TEMPLATE = app

        SOURCES += main.cpp
        SOURCES += mainwindow.cpp
        HEADERS += mainwindow.h
        FORMS += mainwindow.ui
        LIBS += -L$$PWD/lib/ -llibzbar-0.lib

        INCLUDEPATH += $$PWD/include
        DEPENDPATH += $$PWD/include
        @

        and added a folder "lib" which contains

        libzbar-0.lib, libzbar-0.def and libzbar.dll.a

        furthermore i moved the headers in the folder "include".

        But now i get a Prompt saying "During startup programm exited with code 0x0000135"

        1 Reply Last reply
        0
        • S Offline
          S Offline
          steno
          wrote on last edited by
          #4

          Does the ZBar library have other dependencies? If so, they need to be added to the LIBS as well. Other than that, I'm not sure what's going on.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jork
            wrote on last edited by
            #5

            I don't think so. If you want, you can try it yourself.

            Link to ZBAR http://zbar.sourceforge.net/

            Thanks for your help.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Learn
              wrote on last edited by
              #6

              do you know how to link the zbar now?

              1 Reply Last reply
              0
              • L Offline
                L Offline
                Leonardo
                wrote on last edited by Leonardo
                #7

                It's very straightforward:

                LIBS += -llibzbar-0

                The author said he compiled the library with MinGW. Because of that zbar will depend on libgcc_s_dw2-1.dll, MinGW's runtime library. I'd say that the error he reported was caused by him missing this dll in his search path.

                1 Reply Last reply
                0
                • L Offline
                  L Offline
                  Learn
                  wrote on last edited by Learn
                  #8

                  @Leonardo
                  I don't understand what you mean
                  So if i ant to use zbar, i need to compile with MINGW?
                  I can't just use origin lib file without modify it ?

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    Leonardo
                    wrote on last edited by
                    #9

                    I mean that if the library was compiled with MinGW, you might have unexpected dependencies. That's how you get the error he reported. Dependencies are missing.

                    1 Reply Last reply
                    0

                    • Login

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