Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Compiling taglib on Qt

Compiling taglib on Qt

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 4.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sruthihsr
    wrote on last edited by
    #1

    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 to TagLib::ByteVector::ByteVector(char const*)' error: undefined reference to TagLib::ID3v2::Tag::frameListMap() const'
      error: undefined reference to `TagLib::ByteVector::~ByteVector()'
    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chuck Gao
      wrote on last edited by
      #2

      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

      Chuck

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sruthihsr
        wrote on last edited by
        #3

        Thanks,
        It worked for me on addition of -ltag -ltag_c to LIBS in make file

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved