undefined reference to `TagLib::FileRef::FileRef error

Patrick humer4489 at gmail.com
Tue Feb 8 05:55:03 CET 2011


 My .cpp script is overly simple:
------------------------
#include <iostream>
#include <string>

#include <fileref.h>
#include <tag.h>
#include <tstring.h>

using namespace std;
using namespace TagLib;

TagLib::FileRef f("/home/pat/Desktop/song.mp3");
// TagLib::String artist = f.tag()->artist(); 

int main(int argc, char *argv[])
{
    cout << "hello" << endl;
  return 0;
}
--------------------------

my gcc command is as such:

g++  -I/home/pat/Desktop/taglib2/include/taglib -L/home/pat/Desktop/taglib2/lib  /home/pat/Desktop/taglib2/bin/id3.cpp -o /home/pat/Desktop/taglib2/bin/id3
----------------------------

Yet I keep getting the following error when I try to compile my binary: 

/tmp/ccnBuUeL.o: In function `trythis()':
hello.cpp:(.text+0x25): undefined reference to `TagLib::FileRef::FileRef(char const*, bool, TagLib::AudioProperties::ReadStyle)'
hello.cpp:(.text+0x30): undefined reference to `TagLib::FileRef::~FileRef()'
collect2: ld returned 1 exit status
------------------------------

However, if I comment out the 'TagLib::FileRef f("/home/pat/Desktop/song.mp3");'
 it compiles flawlessly, 
would someone please tell me what I am missing in utilizing the TagLib namespace?

Any help would be greatly appreciated, Thank you.

 


More information about the taglib-devel mailing list