0

So I am using TagLib in WinRT Component and trying to get Album arts of mp3 files and then save them to separate files. So far I am using this code:

            auto albumartFolder = ApplicationData::Current->LocalFolder;
            StorageFile^ destStorageFile = create_task(albumartFolder->CreateFileAsync("\\AlbumArts\\" + destFileName + ".jpg")).get();
            TagLib::MPEG::File mpegFile(file->Path->Data());
            static const char *IdPicture = "APIC";

            TagLib::ID3v2::Tag *id3v2tag = mpegFile.ID3v2Tag();
            TagLib::ID3v2::FrameList Frame;
            TagLib::ID3v2::AttachedPictureFrame *PicFrame;
            void *RetImage = NULL, *SrcImage;
            unsigned long Size;
            FILE *jpegFile;
            jpegFile = fopen((char*)destStorageFile->Path->Data(), "wb");
            if (id3v2tag)
            {
                Frame = id3v2tag->frameListMap()[IdPicture];
                if (!Frame.isEmpty())
                {
                    for (TagLib::ID3v2::FrameList::ConstIterator it = Frame.begin(); it != Frame.end(); ++it)
                    {
                        PicFrame = (TagLib::ID3v2::AttachedPictureFrame *)(*it);
                        if ( PicFrame->type() ==
                        TagLib::ID3v2::AttachedPictureFrame::FrontCover)
                        {
                            Size = PicFrame->picture().size();
                            SrcImage = malloc(Size);
                            if (SrcImage)
                            {
                                memcpy(SrcImage, PicFrame->picture().data(), Size);
                                fwrite(SrcImage, Size, 1, jpegFile);
                                fclose(jpegFile);
                                free(SrcImage);
                            }
                        }
                    }
                }
            }

This code should work without a bug I know but here are the exceptions I am recieving:

1>LibraryModule.obj : error LNK2019: unresolved external symbol "public: __thiscall TagLib::FileName::FileName(wchar_t const *)" (??0FileName@TagLib@@QAE@PB_W@Z) referenced in function "public: bool __thiscall <lambda_88d334404ef137d46dbb027b26f435b8>::operator()(void)const " (??R<lambda_88d334404ef137d46dbb027b26f435b8>@@QBE_NXZ)
1>LibraryModule.obj : error LNK2019: unresolved external symbol "public: __thiscall TagLib::MPEG::File::File(class TagLib::FileName,bool,enum TagLib::AudioProperties::ReadStyle)" (??0File@MPEG@TagLib@@QAE@VFileName@2@_NW4ReadStyle@AudioProperties@2@@Z) referenced in function "public: bool __thiscall <lambda_88d334404ef137d46dbb027b26f435b8>::operator()(void)const " (??R<lambda_88d334404ef137d46dbb027b26f435b8>@@QBE_NXZ)
1>LibraryModule.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall TagLib::MPEG::File::~File(void)" (??1File@MPEG@TagLib@@UAE@XZ) referenced in function "public: bool __thiscall <lambda_88d334404ef137d46dbb027b26f435b8>::operator()(void)const " (??R<lambda_88d334404ef137d46dbb027b26f435b8>@@QBE_NXZ)

Any help regarding this would be appreciated very much!

Edit: So, this is marked as duplicate but I still cannot fix the problem. How do I link Taglib correctly? I installed the Nuget package, was I wrong to do so?

thecodrr
  • 265
  • 1
  • 2
  • 13
  • 2
    Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Richard Critten Mar 23 '17 at 15:15
  • https://github.com/taglib/taglib/issues/768 – Hans Passant Mar 23 '17 at 15:55
  • @HansPassant Actually I tried that before trying this and it works flawlessly but I would like to experiment with this as TagLibUWP lacks some APIs which include checking for corrupted files & tags. – thecodrr Mar 23 '17 at 15:59

0 Answers0