LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-28-2007, 09:45 AM   #1
BackwardsDown
Member
 
Registered: Nov 2005
Posts: 66

Rep: Reputation: 15
including id3lib


Hi, I want to create a qt program that reads id3-tags. I have installed id3lib (http://id3lib.sourceforge.net/). The examples provided by the .tar.gz are compiling just fine. But when I try to doe something with id3lib, it wont compile:

Quote:
niels@niels-desktop:~/Programmeer/qt/id3$ make
g++ -o id3 main.o -L/usr/share/qt3/lib -L/usr/X11R6/lib -lqt-mt -lXext -lX11 -lm -lpthread
main.o: In function `main':
main.cpp.text+0xb7): undefined reference to `ID3_Tag::ID3_Tag(char const*)'
main.cpp.text+0x174): undefined reference to `ID3_Tag::~ID3_Tag()'
main.cpp.text+0x1d3): undefined reference to `ID3_Tag::~ID3_Tag()'
collect2: ld returned 1 exit status
make: *** [id3] Error 1
niels@niels-desktop:~/Programmeer/qt/id3$
Source:
Code:
/****************************************************************
**
** Qt tutorial 1
**
****************************************************************/

#include <qapplication.h>
#include <qpushbutton.h>

#include <id3/tag.h> 

int main( int argc, char **argv )
{
    ID3_Tag myTag;

    QApplication a( argc, argv );

    QPushButton hello( "Hello world!", 0 );
    hello.resize( 100, 30 );

    a.setMainWidget( &hello );
    hello.show();
    return a.exec();
}
Everything exept these 2 lines:
#include <id3/tag.h>
ID3_Tag myTag;
is just the standard qt hello_world program.
I compiled it through:
Quote:
qmake -project
qmake
make
 
Old 01-29-2007, 02:17 AM   #2
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
By the look of it you need to link in the id3 library. You can add it as a library in the qmake project file.
 
Old 01-29-2007, 09:06 AM   #3
BackwardsDown
Member
 
Registered: Nov 2005
Posts: 66

Original Poster
Rep: Reputation: 15
Quote:
By the look of it you need to link in the id3 library. You can add it as a library in the qmake project file.
And how can I do that? I understand shit of linkers, library's and stuff.

There are tons of books an tutorials on programming in C++ but I cant find any document regarding how to deal with third-party library's
 
Old 01-29-2007, 10:13 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Try the QT documantation you should also have a local copy when you installed QT. All the best.
 
Old 01-29-2007, 12:16 PM   #5
BackwardsDown
Member
 
Registered: Nov 2005
Posts: 66

Original Poster
Rep: Reputation: 15
The documentation gives me this example:

Quote:
LIBS += -L/usr/local/lib -lmath
But what should I put in my .pro file?

This for example doesnt work:
Quote:
LIBS += -L/usr/local/lib -llibid3
 
Old 01-29-2007, 03:35 PM   #6
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-30
Posts: 5,290

Rep: Reputation: 916Reputation: 916Reputation: 916Reputation: 916Reputation: 916Reputation: 916Reputation: 916Reputation: 916
hi, i had the same issues with trying to use id3lib with libmtp to send mp3's to my portable media player.

i gave up, so i made a script (i'm at home so i'll repost it later) that would extract the title/ singer/ album info from a grip ripped cd.

it was a combination of strings ,sed and head
from my analysis id3v1 tags were on the bottom of the file and id3v2 tags were at the top.

happy hacking,
 
Old 01-29-2007, 10:26 PM   #7
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Sorry, I think that as well as linking in the library you will need to link in the header files. You can set that by using the INCLUDEPATH followed by the path to theheader files. See the QT documentation
 
Old 01-31-2007, 09:50 AM   #8
BackwardsDown
Member
 
Registered: Nov 2005
Posts: 66

Original Poster
Rep: Reputation: 15
I have got a map on my computer named: /usr/local/include/id3

My id3.pro:
Quote:
######################################################################
# Automatically generated by qmake (1.07a) Sun Jan 28 16:38:33 2007
######################################################################

TEMPLATE = app
CONFIG -= moc
INCLUDEPATH += /usr/local/include/id3

# Input
SOURCES += main.cpp
LIBS += -L/usr/local/lib -llibid3
Output make:
Quote:
g++ -o id3 main.o -L/usr/share/qt3/lib -L/usr/X11R6/lib -L/usr/local/lib -llibid3 -lqt-mt -lXext -lX11 -lm -lpthread
/usr/bin/ld: cannot find -llibid3
collect2: ld returned 1 exit status
make: *** [id3] Error 1
So the --llibid3 isnt a legal command, but what should it be then?





edit:
Quote:
The paths to the libraries themselves can be given, or the familiar Unix-style notation for specifying libraries and paths can be used if preferred.
What extension does a library has in linux?




edit2:
I got it working
I had to include the libid3.a like this:
Quote:
LIBS += /usr/lib/libid3.a

Last edited by BackwardsDown; 01-31-2007 at 09:58 AM.
 
Old 01-31-2007, 10:44 AM   #9
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Excellent...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
id3lib Strip? bendeco13 Programming 0 04-04-2006 02:10 AM
C++ Segmentation Fault id3lib bendeco13 Programming 3 10-26-2005 08:05 PM
Yammi and id3lib problem Tsoots Linux - Software 1 03-13-2004 06:35 AM
configuring gtkpod id3lib error RinGz Linux - Software 1 12-28-2003 03:08 PM
id3lib errors jpc82 Programming 1 10-06-2003 06:51 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration