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. Taglib Library
Forum Updated to NodeBB v4.3 + New Features

Taglib Library

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
27 Posts 4 Posters 5.4k 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.
  • Lucas_1603L Lucas_1603

    @jsulm I downloaded taglib from taglib.org and used cmake to build it. After successfully built, I got a .dll and a .dll.a file. What I have to do next to link taglib to my project? I'm new in Qt so guide me step-by-step, please.
    Thanks a lot

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

    @lucas_1603 There should be a .lib file as well as @raven-worx said.
    Also, the way you use LIBS in pro file is wrong: remove .dll from file name (again, like @raven-worx suggested). When adding libs using -l the "lib" prefix and file extension (.lib, .so, ...) must be removed. Example: if lib is called libfoo.lib you add "-lfoo" to your pro file.

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

    Lucas_1603L 1 Reply Last reply
    0
    • jsulmJ jsulm

      @lucas_1603 There should be a .lib file as well as @raven-worx said.
      Also, the way you use LIBS in pro file is wrong: remove .dll from file name (again, like @raven-worx suggested). When adding libs using -l the "lib" prefix and file extension (.lib, .so, ...) must be removed. Example: if lib is called libfoo.lib you add "-lfoo" to your pro file.

      Lucas_1603L Offline
      Lucas_1603L Offline
      Lucas_1603
      wrote on last edited by
      #7

      @jsulm I actually cannot find any .lib files. I built taglib following the guidelines of this tutorial. After building process completed, it just generated 2 files more, one is .dll and the other is .dll.a as I said before. I don't know whether I built taglib right or wrong, or there were something I don't well aware of :((

      jsulmJ 1 Reply Last reply
      0
      • Lucas_1603L Lucas_1603

        @jsulm I actually cannot find any .lib files. I built taglib following the guidelines of this tutorial. After building process completed, it just generated 2 files more, one is .dll and the other is .dll.a as I said before. I don't know whether I built taglib right or wrong, or there were something I don't well aware of :((

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

        @lucas_1603 Then fix LIBS in your pro file as described before and try again.

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

        Lucas_1603L 1 Reply Last reply
        0
        • jsulmJ jsulm

          @lucas_1603 Then fix LIBS in your pro file as described before and try again.

          Lucas_1603L Offline
          Lucas_1603L Offline
          Lucas_1603
          wrote on last edited by
          #9

          @jsulm I tried to fix it to LIBS += -L$$PWD/taglib -ltag as you suggested but it raised "cannot find -ltag" error!

          jsulmJ 1 Reply Last reply
          0
          • Lucas_1603L Lucas_1603

            @jsulm I tried to fix it to LIBS += -L$$PWD/taglib -ltag as you suggested but it raised "cannot find -ltag" error!

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

            @lucas_1603 What is the exact file name of the lib?
            Also, $$PWD/taglib is a relative path - are you sure it is correct (you can check the linker output to see what exactly is passed to -L.

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

            Lucas_1603L 1 Reply Last reply
            0
            • jsulmJ jsulm

              @lucas_1603 What is the exact file name of the lib?
              Also, $$PWD/taglib is a relative path - are you sure it is correct (you can check the linker output to see what exactly is passed to -L.

              Lucas_1603L Offline
              Lucas_1603L Offline
              Lucas_1603
              wrote on last edited by
              #11

              @jsulm I would like to describe more details for you to understand my problems clearly


              This is exactly what I have tried :

              After downloading taglib (version 1.11.1) from taglib.org, I built it with cmake and got a .dll and a .dll.a file. Then I brought taglib folder to where my Qt project folder is in and named it 'myTaglib' as this picture

              0_1568179046840_d68d612f-8fa6-4b6b-a3cd-6f08b865a89c-image.png

              When I go to 'myTaglib' folder, I'll get these items

              0_1568179174653_477fd0c0-2ce1-449c-9514-859557de7c2f-image.png
              Now jumping into .pro file, I tried to link to taglib:

              QT += quick multimedia core
              CONFIG += c++11
              INCLUDEPATH += $$PWD/myTaglib
              DEPENDPATH += $$PWD/myTaglib
              LIBS += -L$$PWD/myTaglib -ltag
              

              And in header file, I included necessary files and using namespace TagLib like this:

              #include <tag.h>
              #include <fileref.h>
              #include <mpeg/id3v2/id3v2tag.h>
              #include <mpeg/mpegfile.h>
              #include <mpeg/id3v2/id3v2frame.h>
              #include <mpeg/id3v2/id3v2header.h>
              #include <mpeg/id3v2/frames/attachedpictureframe.h>
              using namespace TagLib;
              

              After all, I built my project and got some errors:

              ...
              undefined reference to `__imp__ZN6TagLib8FileNameC1EPKc' in player.cpp - line 94
              undefined reference to `__imp__ZN6TagLib7FileRefC1ENS_8FileNameEbNS_15AudioProperties9ReadStyleE' in player.cpp - line 94
              undefined reference to `__imp__ZNK6TagLib7FileRef3tagEv' in player.cpp - line 95
              undefined reference to `__imp__ZNK6TagLib6String10toCWStringEv' in player.cpp - line 97
              undefined reference to `__imp__ZNK6TagLib6String10toCWStringEv' in player.cpp - line 96
              ...
              

              Then, I checked these lines but it didn't show something like underlined error or red text or something like that, you can see this picture

              0_1568179229760_05b4470b-fb3c-4c9c-a996-73498a0a3e5a-image.png

              jsulmJ raven-worxR 2 Replies Last reply
              0
              • Lucas_1603L Lucas_1603

                @jsulm I would like to describe more details for you to understand my problems clearly


                This is exactly what I have tried :

                After downloading taglib (version 1.11.1) from taglib.org, I built it with cmake and got a .dll and a .dll.a file. Then I brought taglib folder to where my Qt project folder is in and named it 'myTaglib' as this picture

                0_1568179046840_d68d612f-8fa6-4b6b-a3cd-6f08b865a89c-image.png

                When I go to 'myTaglib' folder, I'll get these items

                0_1568179174653_477fd0c0-2ce1-449c-9514-859557de7c2f-image.png
                Now jumping into .pro file, I tried to link to taglib:

                QT += quick multimedia core
                CONFIG += c++11
                INCLUDEPATH += $$PWD/myTaglib
                DEPENDPATH += $$PWD/myTaglib
                LIBS += -L$$PWD/myTaglib -ltag
                

                And in header file, I included necessary files and using namespace TagLib like this:

                #include <tag.h>
                #include <fileref.h>
                #include <mpeg/id3v2/id3v2tag.h>
                #include <mpeg/mpegfile.h>
                #include <mpeg/id3v2/id3v2frame.h>
                #include <mpeg/id3v2/id3v2header.h>
                #include <mpeg/id3v2/frames/attachedpictureframe.h>
                using namespace TagLib;
                

                After all, I built my project and got some errors:

                ...
                undefined reference to `__imp__ZN6TagLib8FileNameC1EPKc' in player.cpp - line 94
                undefined reference to `__imp__ZN6TagLib7FileRefC1ENS_8FileNameEbNS_15AudioProperties9ReadStyleE' in player.cpp - line 94
                undefined reference to `__imp__ZNK6TagLib7FileRef3tagEv' in player.cpp - line 95
                undefined reference to `__imp__ZNK6TagLib6String10toCWStringEv' in player.cpp - line 97
                undefined reference to `__imp__ZNK6TagLib6String10toCWStringEv' in player.cpp - line 96
                ...
                

                Then, I checked these lines but it didn't show something like underlined error or red text or something like that, you can see this picture

                0_1568179229760_05b4470b-fb3c-4c9c-a996-73498a0a3e5a-image.png

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

                @lucas_1603 Can you show the linker call? Either it can't find the lib or the lib is not compatible.

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

                Lucas_1603L 1 Reply Last reply
                0
                • jsulmJ jsulm

                  @lucas_1603 Can you show the linker call? Either it can't find the lib or the lib is not compatible.

                  Lucas_1603L Offline
                  Lucas_1603L Offline
                  Lucas_1603
                  wrote on last edited by
                  #13

                  @jsulm You mean this one (sorry if I misunderstood what you mean):
                  0_1568179729372_09905dc4-15dd-42d4-84dc-cd8cbfbe052a-image.png

                  jsulmJ 1 Reply Last reply
                  0
                  • Lucas_1603L Lucas_1603

                    @jsulm You mean this one (sorry if I misunderstood what you mean):
                    0_1568179729372_09905dc4-15dd-42d4-84dc-cd8cbfbe052a-image.png

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

                    @lucas_1603 Yes, your taglib is not compatible with the compiler you're using.
                    Do you really use exact same compiler you used to compile taglib?

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

                    Lucas_1603L 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @lucas_1603 Yes, your taglib is not compatible with the compiler you're using.
                      Do you really use exact same compiler you used to compile taglib?

                      Lucas_1603L Offline
                      Lucas_1603L Offline
                      Lucas_1603
                      wrote on last edited by
                      #15

                      @jsulm I built taglib with MinGW and in this project I think it also built with MinGW
                      0_1568180758700_d5cd9775-3482-46ed-94bf-f581462d40af-image.png

                      jsulmJ 1 Reply Last reply
                      0
                      • Lucas_1603L Lucas_1603

                        @jsulm I built taglib with MinGW and in this project I think it also built with MinGW
                        0_1568180758700_d5cd9775-3482-46ed-94bf-f581462d40af-image.png

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

                        @lucas_1603 I'm not a Windows expert, but I think you really need .lib file on Windows at build time, not .dll

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

                        Lucas_1603L 1 Reply Last reply
                        0
                        • jsulmJ jsulm

                          @lucas_1603 I'm not a Windows expert, but I think you really need .lib file on Windows at build time, not .dll

                          Lucas_1603L Offline
                          Lucas_1603L Offline
                          Lucas_1603
                          wrote on last edited by
                          #17

                          @jsulm Yes, I'll try to find it out. Anw, thank you so much for your time, you helped me a lot

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

                            Hi,

                            One other thing that you can try is to link directly to the static .a library. Use the full path to that file using $$PWD.

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

                            Lucas_1603L 1 Reply Last reply
                            1
                            • Lucas_1603L Lucas_1603

                              @jsulm I would like to describe more details for you to understand my problems clearly


                              This is exactly what I have tried :

                              After downloading taglib (version 1.11.1) from taglib.org, I built it with cmake and got a .dll and a .dll.a file. Then I brought taglib folder to where my Qt project folder is in and named it 'myTaglib' as this picture

                              0_1568179046840_d68d612f-8fa6-4b6b-a3cd-6f08b865a89c-image.png

                              When I go to 'myTaglib' folder, I'll get these items

                              0_1568179174653_477fd0c0-2ce1-449c-9514-859557de7c2f-image.png
                              Now jumping into .pro file, I tried to link to taglib:

                              QT += quick multimedia core
                              CONFIG += c++11
                              INCLUDEPATH += $$PWD/myTaglib
                              DEPENDPATH += $$PWD/myTaglib
                              LIBS += -L$$PWD/myTaglib -ltag
                              

                              And in header file, I included necessary files and using namespace TagLib like this:

                              #include <tag.h>
                              #include <fileref.h>
                              #include <mpeg/id3v2/id3v2tag.h>
                              #include <mpeg/mpegfile.h>
                              #include <mpeg/id3v2/id3v2frame.h>
                              #include <mpeg/id3v2/id3v2header.h>
                              #include <mpeg/id3v2/frames/attachedpictureframe.h>
                              using namespace TagLib;
                              

                              After all, I built my project and got some errors:

                              ...
                              undefined reference to `__imp__ZN6TagLib8FileNameC1EPKc' in player.cpp - line 94
                              undefined reference to `__imp__ZN6TagLib7FileRefC1ENS_8FileNameEbNS_15AudioProperties9ReadStyleE' in player.cpp - line 94
                              undefined reference to `__imp__ZNK6TagLib7FileRef3tagEv' in player.cpp - line 95
                              undefined reference to `__imp__ZNK6TagLib6String10toCWStringEv' in player.cpp - line 97
                              undefined reference to `__imp__ZNK6TagLib6String10toCWStringEv' in player.cpp - line 96
                              ...
                              

                              Then, I checked these lines but it didn't show something like underlined error or red text or something like that, you can see this picture

                              0_1568179229760_05b4470b-fb3c-4c9c-a996-73498a0a3e5a-image.png

                              raven-worxR Offline
                              raven-worxR Offline
                              raven-worx
                              Moderators
                              wrote on last edited by raven-worx
                              #19

                              @lucas_1603
                              rename taglib.dll.a to taglib.a

                              Also read this

                              --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                              If you have a question please use the forum so others can benefit from the solution in the future

                              Lucas_1603L 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                Hi,

                                One other thing that you can try is to link directly to the static .a library. Use the full path to that file using $$PWD.

                                Lucas_1603L Offline
                                Lucas_1603L Offline
                                Lucas_1603
                                wrote on last edited by
                                #20

                                @sgaist I tried this:

                                LIBS += -L$$PWD/myTaglib -llibtag.dll.a
                                

                                But the linker said "cannot find -llibtag.dll.a"

                                0_1568186282504_b509288b-18da-4b10-95eb-9f07c6a52c8c-image.png

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

                                  As already suggested, try with LIBS += -l$$PWD/myTagLib/libtag.dll.a

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

                                  1 Reply Last reply
                                  0
                                  • raven-worxR raven-worx

                                    @lucas_1603
                                    rename taglib.dll.a to taglib.a

                                    Also read this

                                    Lucas_1603L Offline
                                    Lucas_1603L Offline
                                    Lucas_1603
                                    wrote on last edited by
                                    #22

                                    @raven-worx
                                    After rename, I got these:
                                    0_1568186557563_5f77e916-dfc5-4c2e-9222-bcb6ff540f70-image.png

                                    And in .pro file, I wrote:

                                    INCLUDEPATH += $$PWD/myTaglib
                                    DEPENDPATH += $$PWD/myTaglib
                                    LIBS += -L$$PWD/myTaglib -ltag
                                    

                                    But I still got some errors:
                                    0_1568186656286_ecd0b346-0693-4b1d-bdf9-d679133936da-image.png

                                    raven-worxR jsulmJ 2 Replies Last reply
                                    0
                                    • Lucas_1603L Lucas_1603

                                      @raven-worx
                                      After rename, I got these:
                                      0_1568186557563_5f77e916-dfc5-4c2e-9222-bcb6ff540f70-image.png

                                      And in .pro file, I wrote:

                                      INCLUDEPATH += $$PWD/myTaglib
                                      DEPENDPATH += $$PWD/myTaglib
                                      LIBS += -L$$PWD/myTaglib -ltag
                                      

                                      But I still got some errors:
                                      0_1568186656286_ecd0b346-0693-4b1d-bdf9-d679133936da-image.png

                                      raven-worxR Offline
                                      raven-worxR Offline
                                      raven-worx
                                      Moderators
                                      wrote on last edited by
                                      #23

                                      @lucas_1603 said in Taglib Library:

                                      But I still got some errors:

                                      your problem is not that it can't find the lib but that it finds it already and says it is incompatible.
                                      So you need to change the compiler in either of your 2 compilations.

                                      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
                                      If you have a question please use the forum so others can benefit from the solution in the future

                                      Lucas_1603L 1 Reply Last reply
                                      0
                                      • Lucas_1603L Offline
                                        Lucas_1603L Offline
                                        Lucas_1603
                                        wrote on last edited by
                                        #24

                                        @sgaist
                                        I tried it out but it still didn't work, here is what I got:
                                        0_1568187535214_c1acc79f-fa58-44bd-b417-c4a18fa39530-image.png
                                        I don't know why libtag.dll.a was in the same folder as my project (Drive E) but it said "cannot find..."

                                        1 Reply Last reply
                                        0
                                        • raven-worxR raven-worx

                                          @lucas_1603 said in Taglib Library:

                                          But I still got some errors:

                                          your problem is not that it can't find the lib but that it finds it already and says it is incompatible.
                                          So you need to change the compiler in either of your 2 compilations.

                                          Lucas_1603L Offline
                                          Lucas_1603L Offline
                                          Lucas_1603
                                          wrote on last edited by
                                          #25

                                          @raven-worx
                                          I built taglib with MinGW and I also did that for my project.
                                          I built taglib by this code block (followed by this tutorial):

                                          cd $TAGLIB
                                          mkdir build
                                          cd build
                                          cmake -G "MinGW Makefiles" -D CMAKE_CXX_COMPILER=g++.exe -D CMAKE_MAKE_PROGRAM=mingw32-make.exe -DBUILD_SHARED_LIBS=ON -DENABLE_STATIC_RUNTIME=OFF ..
                                          

                                          And here is the compiler of my project:

                                          0_1568188775836_119ffd66-6a39-49df-8bb2-53939d217323-image.png

                                          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