Compiling taglib on Qt
-
Hi I have the following program in Qt running on Fedora 9. I am using Taglib library to extract album cover.
@TagLib::MPEG::File mpegFile(fileName,true,TagLib::AudioProperties::Average);
TagLib::ID3v2::Tag *id3v2tag = mpegFile.ID3v2Tag(true);
TagLib::ID3v2::FrameList Frame ;
TagLib::ID3v2::AttachedPictureFrame *PicFrame ;
void *RetImage = NULL, *SrcImage ;
unsigned long Size ;FILE *jpegFile; fopen ("&jpegFile;.jpg","wb"); if ( id3v2tag ) { // picture frame Frame = id3v2tag->frameListMap()["IdPicture"] ; if (!Frame.isEmpty() ) { // find cover art for(TagLib::ID3v2::FrameList::ConstIterator it = Frame.begin(); it != Frame.end(); ++it) { PicFrame = (TagLib::ID3v2::AttachedPictureFrame *)(*it) ; if ( PicFrame->type() == TagLib::ID3v2::AttachedPictureFrame::FrontCover) { // extract image (in it's compressed form) Size = PicFrame->picture().size() ; SrcImage = malloc ( Size ) ; if ( SrcImage ) { memcpy ( SrcImage, PicFrame->picture().data(), Size ) ; fwrite(SrcImage,Size,1, jpegFile); fclose(jpegFile); free( SrcImage ) ; } if ( RetImage ) break ; } } } }@
I am getting the following linking errors. Can anybody tell me how do I resolve it.
- error: undefined reference to
TagLib::MPEG::File::File(char const*, bool, TagLib::AudioProperties::ReadStyle)' error: undefined reference to
TagLib::MPEG::File::ID3v2Tag(bool)'
error: undefined reference toTagLib::ByteVector::ByteVector(char const*)' error: undefined reference to
TagLib::ID3v2::Tag::frameListMap() const'
error: undefined reference to `TagLib::ByteVector::~ByteVector()'
- error: undefined reference to
-
Hi sruthihsr, your code are not easy to identify where is the functon entry, and seems miss "}" somewhere, can you make it more readable?
Do you link the lib when you use TagLib? (I think that's the most possible reason for undefined reference)
Btw, You can use "using" keywork to simplify the namesapce