Taglib Library
-
@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 :((
-
@lucas_1603 Then fix LIBS in your pro file as described before and try again.
-
@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. -
@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
When I go to 'myTaglib' folder, I'll get these items
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
-
@lucas_1603 Can you show the linker call? Either it can't find the lib or the lib is not compatible.
-
@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_1603 I'm not a Windows expert, but I think you really need .lib file on Windows at build time, not .dll
-
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_1603
renametaglib.dll.a
totaglib.a
Also read this
-
As already suggested, try with
LIBS += -l$$PWD/myTagLib/libtag.dll.a
-
@raven-worx
After rename, I got these:
And in .pro file, I wrote:
INCLUDEPATH += $$PWD/myTaglib DEPENDPATH += $$PWD/myTaglib LIBS += -L$$PWD/myTaglib -ltag
But I still got some errors:
-
@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. -
@sgaist
I tried it out but it still didn't work, here is what I got:
I don't know why libtag.dll.a was in the same folder as my project (Drive E) but it said "cannot find..." -
@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:
-
@lucas_1603 Come on, your lib is called libtag.a not libtag.dll.a, so please change it to
LIBS += -l$$PWD/myTagLib/libtag.a