0

==================================

Configuration :

  • Qt Creator 2.8.1
  • Qt 5.1.1
  • Windows 7 64 bits

==================================

How can I include id3lib library ?

I've already donwloaded required files (.h, .dll, .lib and .exp) from http://sourceforge.net/projects/id3lib/files/

I've already included all .h file in my project :

HEADERS  += audioTest.h \
    id3.h \
    id3/writers.h \
    id3/writer.h \
    id3/utils.h \
    id3/tag.h \
    id3/sized_types.h \
    id3/readers.h \
    id3/reader.h \
    id3/misc_support.h \
    id3/io_strings.h \
    id3/io_helpers.h \
    id3/io_decorators.h \
    id3/id3lib_strings.h \
    id3/id3lib_streams.h \
    id3/id3lib_frame.h \
    id3/helpers.h \
    id3/globals.h \
    id3/field.h

Then I've included the library :

win32: LIBS += -L$$PWD/id3lib/ -lid3lib
INCLUDEPATH += $$PWD/id3lib
DEPENDPATH += $$PWD/id3lib
win32: PRE_TARGETDEPS += $$PWD/id3lib/id3lib.lib

Then, when I execute the bellow example, it tells me

  • undefined reference to ID3_Tag::ID3_Tag(char const*)'
  • undefined reference to 'ID3_Tag::~ID3_Tag()'
  • error: ld returned 1 exit status

Code :

ID3_Tag tag("a.mp3");

Something wrong with what I've done ? I know undefined reference to * means a bad library inclusion, but I can't find where I failed.

And I can't find solution on the web :

  • Here they decide to use taglib, but I read here id3lib was better.
  • Here they say LIBS += /usr/lib/libid3.a works. But not on Windows.
  • ...

Someone got an idea ?

David
  • 4,785
  • 7
  • 39
  • 63

2 Answers2

0

You have several problems ongoing...

First of all, you do not need to include 3rd party headers into your HEADERS variable. You only need to specify the location for the INCLUDEPATH if any.

Secondly, you will need to specify the library name and location for the LIBS variable as follows:

LIBS += -L/path/to/id3lib/installation -lid3libname
László Papp
  • 51,870
  • 39
  • 111
  • 135
  • But id3lib is not delivered with sources file... Just .h, .lib, .dll and .a... Or I don't understand what you mean by including sources file – David Jan 11 '14 at 11:18
  • @LetAurn: you need to import the _source_ of the 3rd party project into your project. If it is header only, you definitely should not link against it which you seem to be doing. – László Papp Jan 11 '14 at 11:20
  • So you are telling me to include some headers only ? – David Jan 11 '14 at 11:42
  • Ok, I removed all id3lib headers from `HEADERS` and I did thid : `LIBS += -L$$PWD/id3/ -lid3lib` `INCLUDEPATH += $$PWD/id3` But still doesn't work. – David Jan 11 '14 at 12:29
  • Does not work : same problem. `undefined reference to ID3_Tag::ID3_Tag(char const*)'`, `undefined reference to ID3_Tag::~ID3_Tag()'` – David Jan 11 '14 at 12:33
  • I am pretty sure the problem is because I use MinGW. No ? – David Jan 11 '14 at 23:20
  • Pardon? The very beginning of your question states: "Qt 5.1.1 (MSVC 2010, 32 bits)". Please do not trick us. :) – László Papp Jan 11 '14 at 23:21
  • :D it was in "About Qt Creator" dialog, sorry. I didn't notice the `g++ -c -pipe XXX` in logs. – David Jan 11 '14 at 23:25
  • As requested already, check whether the symbols are actually available... although, if you have symbols stripped, you will not be lucky. – László Papp Jan 11 '14 at 23:26
  • Yes, I'm looking for an equivalent of `nm` command on Windows. http://stackoverflow.com/questions/375273/microsoft-equivalent-of-the-nm-command – David Jan 11 '14 at 23:30
  • I do not need the output. :) It is you who should check it. I cannot really do much more on top of it. – László Papp Jan 11 '14 at 23:43
  • humm... how ? I got this result, how can I check it now ? wait, http://stackoverflow.com/questions/305287/how-to-see-the-contents-of-windows-library-lib – David Jan 11 '14 at 23:49
  • @LetAurn: have you resolved the nitty-gritty details? – László Papp Jan 22 '14 at 09:39
  • No, I decided to use `TagLib 1.9-1`, which I recompiled to run it succesfully. That made me think that the pre-compiled version of id3lib was not supported by my gcc version. I am pretty sure it was my problem. – David Jan 22 '14 at 17:37
  • @LetAurn: OK, in that case, if you do not wish to fix the issue, I will vote on your question to be closed unfortunately because we cannot reproduce it. – László Papp Jan 22 '14 at 17:59
0

How do you compile? I have Linux and compile with g++ -lid3 -lz. Switch -lid3 is for id3lib which needs compress as well so -lz.

Volt
  • 99
  • 1
  • 7