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. Integrating zbar library
Forum Updated to NodeBB v4.3 + New Features

Integrating zbar library

Scheduled Pinned Locked Moved Solved 3rd Party Software
5 Posts 3 Posters 1.1k 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.
  • B Offline
    B Offline
    bhargavah
    wrote on last edited by
    #1

    Hi Guys,

    I was able to install the qt into my machine and now I have started to build my project which is the scanning of the barcode reader. I have decided to use 'zbar' library for this purpose and installed the same in my macOs.

    This is how I verified the installation of 'zbar'.

    apple@Apples-MacBook-Air barcode % pkg-config --cflags --libs zbar 
    -I/usr/local/Cellar/zbar/0.23.90_4/include -L/usr/local/Cellar/zbar/0.23.90_4/lib -lzbar
    

    Now, I would like to integrate this in my Qt6.4 system and I started with:

    target_link_libraries(camera PUBLIC /usr/local/Cellar/zbar/0.23.90_4/lib/libzbar)
    

    And this did not work.

    How do I integrate 'zbar' and Qt 6.4 otherwise?

    1 Reply Last reply
    0
    • JoeCFDJ JoeCFD

      @bhargavah
      add something like:
      include_directories(${ZBAR_INCLUDE_DIRS})

      B Offline
      B Offline
      bhargavah
      wrote on last edited by
      #5

      @JoeCFD I was able to find an answer to this question by doing this:

      find_package(PkgConfig REQUIRED)
      pkg_check_modules(ZBar REQUIRED IMPORTED_TARGET zbar)
      target_link_libraries(camera PUBLIC PkgConfig::ZBar)
      Since I anyway had pkg-config, I found that package and then zbar using that package and then linked it with the libraries.

      1 Reply Last reply
      2
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        Since you have pkg-config, something along the lines of:

        find_package(PkgConfig REQUIRED)
        pkg_check_modules(ZBAR REQUIRED zbar)
        target_link_libraries(camera ${ZBAR_LINK_LIBRARIES})
        

        Note that I haven't tested it.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        B 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Since you have pkg-config, something along the lines of:

          find_package(PkgConfig REQUIRED)
          pkg_check_modules(ZBAR REQUIRED zbar)
          target_link_libraries(camera ${ZBAR_LINK_LIBRARIES})
          

          Note that I haven't tested it.

          B Offline
          B Offline
          bhargavah
          wrote on last edited by
          #3

          @SGaist Hey. Much thanks for the reply. Adding your suggestion into the CMake file and doing #include
          zbar.h into the cpp file does not work. It says that zbar.h file not found.

          Thank you.

          JoeCFDJ 1 Reply Last reply
          0
          • B bhargavah

            @SGaist Hey. Much thanks for the reply. Adding your suggestion into the CMake file and doing #include
            zbar.h into the cpp file does not work. It says that zbar.h file not found.

            Thank you.

            JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by
            #4

            @bhargavah
            add something like:
            include_directories(${ZBAR_INCLUDE_DIRS})

            B 1 Reply Last reply
            0
            • JoeCFDJ JoeCFD

              @bhargavah
              add something like:
              include_directories(${ZBAR_INCLUDE_DIRS})

              B Offline
              B Offline
              bhargavah
              wrote on last edited by
              #5

              @JoeCFD I was able to find an answer to this question by doing this:

              find_package(PkgConfig REQUIRED)
              pkg_check_modules(ZBar REQUIRED IMPORTED_TARGET zbar)
              target_link_libraries(camera PUBLIC PkgConfig::ZBar)
              Since I anyway had pkg-config, I found that package and then zbar using that package and then linked it with the libraries.

              1 Reply Last reply
              2
              • SGaistS SGaist has marked this topic as solved on

              • Login

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