如何解决MediaFoundation 使用时如何解决链接错误?
我有一个有效的解决方案,然后我需要添加一个具有 MediaFoundation
实现的项目。因此,为了包含它,我将此项目添加为现有项目,然后在常规部分的配置中我提供了 .h
文件的路径,然后在 Liker 输入中添加了 .lib
在此之后,我尝试使用它并在我的一个文件中写入 include
,然后从添加的这个项目中调用了一些方法。
当我尝试编译我的项目时出现错误:
9>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFStartup referenced in function "private: bool __cdecl co_AudioDecoderMF::InitAndStartCOMLib(void)" (?InitAndStartCOMLib@co_AudioDecoderMF@@AEAA_NXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFShutdown referenced in function "public: virtual void __cdecl co_AudioDecoderMF::Cleanup(void)" (?Cleanup@co_AudioDecoderMF@@UEAAXXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateAttributes referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateSourceReader(void)" (?CreateSourceReader@co_AudioDecoderMF@@AEAA_NXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateMediaType referenced in function "private: bool __cdecl co_AudioDecoderMF::ConfigureAudioStream(enum co_AudioDecoder::SoundDataType,struct IMFSourceReader *,struct IMFMediaType * *)" (?ConfigureAudioStream@co_AudioDecoderMF@@AEAA_NW4SoundDataType@co_AudioDecoder@@PEAUIMFSourceReader@@PEAPEAUIMFMediaType@@@Z)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateMFByteStreamOnStream referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateByteStream(unsigned char const *,__int64)" (?CreateByteStream@co_AudioDecoderMF@@AEAA_NPEBE_J@Z)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateSourceReaderFromByteStream referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateSourceReader(void)" (?CreateSourceReader@co_AudioDecoderMF@@AEAA_NXZ)
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MFAudioFormat_PCM
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_MAJOR_TYPE
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_SUBTYPE
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUdio_NUM_CHANNELS
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUdio_SAMPLES_PER_SECOND
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUdio_BLOCK_ALIGNMENT
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MF_MT_AUdio_BITS_PER_SAMPLE
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2001: unresolved external symbol MFMediaType_Audio
首先很奇怪,因为我已经在其他解决方案中使用了这个项目并且没有问题,但是经过研究我发现我需要在配置Linker -> input
中再添加一些.lib
s
Mf.lib
mfplat.lib
mfuuid.lib
(启发我在我的其他解决方案中没有这些行在哪里工作)并且在我添加这些行之后,很多错误消失了,但还剩下一个
9>co_AudioDecoder.lib(co_AudioDecoderMF.obj) : error LNK2019: unresolved external symbol MFCreateSourceReaderFromByteStream referenced in function "private: bool __cdecl co_AudioDecoderMF::CreateSourceReader(void)" (?CreateSourceReader@co_AudioDecoderMF@@AEAA_NXZ)
而且我还没有找到有关如何解决它的任何信息。我是 C++ 中的一个相对较新的人,看起来很奇怪,为了使 MediaFoundation
(big lib) 工作,我需要花几个小时来找出要额外添加的内容才能使其工作。
那么,问题是 - 我在这里遗漏了什么?
解决方法
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。