PDA

View Full Version : compiling id3lib on windows Qt



harkon
17th April 2010, 18:19
Hello!

I´m using Qt 4.6.2 under Windows XP. I use the complete Qt version with minGW, QtDesigner etc.
then i´m trying to compile a simple code using id3lib (a library to read mp3 informations). My simple code is:

#include <id3/tag.h>

void Principal::on_pushButton_3_clicked()
{
ID3_Tag HarkonTag;
HarkonTag.Link("cabelo.mp3");
}

id3lib website: http://id3lib.sourceforge.net

To compile this, i take the includes files from id3lib and put in c:\qt\2010.02.1\mingw\include and
i had downloaded a "binaries" version of id3lib that contains:

id3lib.dll (573.440 bytes)
id3lib.exp (107.544 bytes)
id3lib.lib (177.036 bytes)


i put this 3 files on c:\qt\2010.02.1\migw\lib, and add to my test.pro

LIBS += -lid3lib

running the "nm id3lib.lib" i get a lot similars of this:

id3lib.dll:
00000000 I .idata$4
00000000 I .idata$5
00000000 I .idata$6
00000000 T .text
00000000 T ??0ID3_Tag@@QAE@ABV0@@Z
U __IMPORT_DESCRIPTOR_id3lib
00000000 I __imp_??0ID3_Tag@@QAE@ABV0@@Z

id3lib.dll:
00000000 I .idata$4
00000000 I .idata$5
00000000 I .idata$6
00000000 T .text
00000000 T ??0ID3_Tag@@QAE@PBD@Z
U __IMPORT_DESCRIPTOR_id3lib
00000000 I __imp_??0ID3_Tag@@QAE@PBD@Z

Looking this and Doing some experiences: testing with the CL compiler, reading the id3lib source
and playing with codes, i suspect that the id3lib.lib call fuctions on id3lib.dll.

So the result of this is that compiling my code occurs this:


Starting: C:/Qt/2010.02.1/mingw/bin/mingw32-make.exe -w
mingw32-make: Entering directory `C:/teste/Teste'
C:/Qt/2010.02.1/mingw/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory `C:/teste/Teste'
c:\Qt\2010.02.1\qt\bin\uic.exe principal.ui -o ui_principal.h
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\Qt\2010.02.1\qt\include\QtCore" -I"..\..\Qt\2010.02.1\qt\include\QtGui" -I"..\..\Qt\2010.02.1\qt\include\QtXml" -I"..\..\Qt\2010.02.1\qt\include" -I"..\..\Qt\2010.02.1\qt\include\ActiveQt" -I"debug" -I"." -I"..\..\Qt\2010.02.1\qt\mkspecs\win32-g++" -o debug\main.o main.cpp
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\Qt\2010.02.1\qt\include\QtCore" -I"..\..\Qt\2010.02.1\qt\include\QtGui" -I"..\..\Qt\2010.02.1\qt\include\QtXml" -I"..\..\Qt\2010.02.1\qt\include" -I"..\..\Qt\2010.02.1\qt\include\ActiveQt" -I"debug" -I"." -I"..\..\Qt\2010.02.1\qt\mkspecs\win32-g++" -o debug\principal.o principal.cpp
C:/Qt/2010.02.1/qt/bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\Qt\2010.02.1\qt\include\QtCore" -I"..\..\Qt\2010.02.1\qt\include\QtGui" -I"..\..\Qt\2010.02.1\qt\include\QtXml" -I"..\..\Qt\2010.02.1\qt\include" -I"..\..\Qt\2010.02.1\qt\include\ActiveQt" -I"debug" -I"." -I"..\..\Qt\2010.02.1\qt\mkspecs\win32-g++" -D__GNUC__ -DWIN32 principal.h -o debug\moc_principal.cpp
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\Qt\2010.02.1\qt\include\QtCore" -I"..\..\Qt\2010.02.1\qt\include\QtGui" -I"..\..\Qt\2010.02.1\qt\include\QtXml" -I"..\..\Qt\2010.02.1\qt\include" -I"..\..\Qt\2010.02.1\qt\include\ActiveQt" -I"debug" -I"." -I"..\..\Qt\2010.02.1\qt\mkspecs\win32-g++" -o debug\moc_principal.o debug\moc_principal.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -mthreads -Wl -Wl,-subsystem,windows -o debug\Teste.exe debug/main.o debug/principal.o debug/moc_principal.o -L"c:\Qt\2010.02.1\qt\lib" -lmingw32 -lqtmaind -lid3lib -lQtXmld4 -lQtGuid4 -lQtCored4
mingw32-make[1]: Leaving directory `C:/teste/Teste'
mingw32-make: Leaving directory `C:/teste/Teste'
debug/principal.o:C:\teste\Teste/principal.cpp:8: undefined reference to `ID3_Tag::ID3_Tag(char const*)'
debug/principal.o:C:\teste\Teste/principal.cpp:9: undefined reference to `ID3_Tag::Link(char const*, unsigned short)'
debug/principal.o:C:\teste\Teste/principal.cpp:9: undefined reference to `ID3_Tag::~ID3_Tag()'
debug/principal.o:C:\teste\Teste/principal.cpp:9: undefined reference to `ID3_Tag::~ID3_Tag()'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [debug\Teste.exe] Error 1
mingw32-make: *** [debug] Error 2
Exited with code 2.
Error while building project Teste
When executing build step 'Make'

with or without the option "LIBS += -lid3lib" the result are the same. exactly the same error showed above.

i had tried to spread id3lib.dll in the "c:\teste\teste" and in "c:\teste\teste\debug", but no effect.

i tried too this code in linux via Qt, but there compiling and installing id3lib. on linux, worked OK, but the libid3.a depends of a libid3.so to compiles ok (this sounds similar to something ?)


And the question that cannot silence: How i do to compile my simple code in windows using id3lib ?

Jarvis
17th April 2010, 20:37
The syntax for win32 is different, unless you are cross-compiling :


unix:LIBS += -L/usr/local/lib -lmath
win32:LIBS += c:/mylibs/math.lib
(taken from Qt Assistant's qmake Variable Reference)

faldzip
17th April 2010, 22:49
The syntax for win32 is different, unless you are cross-compiling :


unix:LIBS += -L/usr/local/lib -lmath
win32:LIBS += c:/mylibs/math.lib
(taken from Qt Assistant's qmake Variable Reference)
Option:


LIBS += -lsomeLibrary

works also with win32.
But, as you use MinGW then you might want an libid3lib.a file instead of id3lib.lib would be my guess. I'm not MinGW user, so I did not do it, but there are some tools to convert this, so search the net (you can start with this forum as it mentioned somewhere recently).

Jarvis
18th April 2010, 00:01
Damn, faldżip, you're right. I did not paid attention to mingw, an important detail.
So yes, id3lib.lib and id3lib.dll must be libid3lib.a and libid3lib.dll.a.
I don't have any hint for any converter.

faldzip
18th April 2010, 07:21
From some other forum thread:


okay, do you have an libpq.a in your C:\Databases\PostgreSQL\8.4\lib?

yes, i used reimp und dlltool for this

giacomelli.fabio
24th April 2010, 10:26
Hello

For me and a lot of others beginners, could you post a step by step ?? I want to use the same library |

Thank you

harkon
26th April 2010, 17:31
Hello

For me and a lot of others beginners, could you post a step by step ?? I want to use the same library |

Thank you

I tried, hardly, to converte, to compile, to engage the src code in my project, but without any sucess. Then, exhausted of trieds, i change. I´m now using TagLib (http://developer.kde.org/~wheeler/taglib.html) and my problems gone!

but if you wanna try and show us the solution, follow some theorics options:

Option 1) "reimp filename.lib", provided that the directory reimp.exe resides in is listed on the PATH environment variable and the command is given in the folder containing filename.lib.
be sure that the dlltool.exe are in the same PATH enviroment.
Option 2) "reimp -d filename.lib" and "dlltool --input-def lifename.def --dllname filename.dll --output-lib filename.a"
Option 3) "pexports filename.dll > filename.def" and "dlltool -D filename.dll -d filename.def -l filename.a"
Option 4) "nm filename.dll | grep " T _" | sed "s/.* T _//" >> filename.def" and "dlltool -D filename.dll -d filename.def -l filename.a"
i see in some cases, the use of "sed "s/.* T _//"" between step one and two.


May the force be with you

giacomelli.fabio
26th April 2010, 22:15
Uhm I only need to read the tags ...
Taglib or id3lib ... it's the same ...
I will try with taglib .... I hope I will not need your help :rolleyes:
I'm a noob ....

EDITED

Ok ... could you post for me a small piece of your project (library and *.pro) ? I'm not able to compile by myself ....( msys ?? ) I found already compiled libraires from another project (clementine, qt apps) but I can't add them :confused::confused:::confused: