如何在Windows运行时组件C ++中调用TagLib

时间:2017-03-23 15:12:13

标签: c++ uwp taglib winrt-component

所以我在WinRT组件中使用TagLib并尝试获取mp3文件的专辑,然后将它们保存到单独的文件中。到目前为止,我正在使用此代码:

            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);
                            }
                        }
                    }
                }
            }

这段代码应该没有我知道的错误,但这是我收到的例外情况:

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)

对此有任何帮助非常感谢!

修改 所以,这被标记为重复,但我仍然无法解决问题。如何正确链接Taglib?我安装了Nuget包,我错了吗?

0 个答案:

没有答案