使用MediaFoundation时如何解决链接错误?

问题描述 投票:0回答:2

我有一个可行的解决方案,然后我需要添加一个实现了

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

(启发我在我的其他解决方案中没有这些行,它在哪里工作)并且在我添加这些行后,很多错误消失了,但还剩下一个

Mf.lib Mfplat.lib mfuuid.lib

而且我还没有找到任何关于如何解决它的信息。我是一个相对较新的 C++ 新手,为了让 
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++ c ms-media-foundation
2个回答
1
投票

#pragma comment(lib, "mfreadwrite")

文档通常会有帮助:

MFCreateSourceReaderFromByteStream 函数


0
投票

MediaFoundation

© www.soinside.com 2019 - 2024. All rights reserved.