编译错误error LNK2019: unresolved external symbol,求解
今天编译一个工程,其中的一个mediastream工程(用vs2008以debug方式编译)总是编译不过去,该工程依赖DirectShow的BaseClasses.
我用vs6.0以debug方式编译了BaseClasses.然后把下面的三个路径
D:\Program Files\DXSDK\Include
D:\Program Files\DXSDK\Samples\C++\DirectShow\BaseClasses
D:\Program Files\DXSDK\Samples\C++\DirectShow\BaseClasses\Debug (strmbasd.lib路径)
分别添加到了mediastream对应的属性页中.
但编译mediastream时出现输出下面的错误
1>Generating Code...
1>Linking...
1>alaw.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification
1> Creating library D:\Source\Source\SipPhoneWorkspace\Debug\mediastreamer2.lib and object D:\Source\Source\SipPhoneWorkspace\Debug\mediastreamer2.exp
1>dxfilter.obj : error LNK2019: unresolved external symbol "public: __thiscall CTransInPlaceFilter::CTransInPlaceFilter(wchar_t *,struct IUnknown *,struct _GUID const &,long *,bool)" (??0CTransInPlaceFilter@@QAE@PA_WPAUIUnknown@@ABU_GUID@@PAJ_N@Z) referenced in function "public: __thiscall CDXFilter::CDXFilter(struct IUnknown *,long *,int)" (??0CDXFilter@@QAE@PAUIUnknown@@PAJH@Z)
1>dxfilter.obj : error LNK2001: unresolved external symbol "public: virtual long __stdcall CTransformFilter::FindPin(wchar_t const *,struct IPin * *)" (?FindPin@CTransformFilter@@UAGJPB_WPAPAUIPin@@@Z)
1>dxfilter.obj : error LNK2001: unresolved external symbol "public: virtual long __stdcall CBaseFilter::JoinFilterGraph(struct IFilterGraph *,wchar_t const *)" (?JoinFilterGraph@CBaseFilter@@UAGJPAUIFilterGraph@@PB_W@Z)
1>dxfilter.obj : error LNK2001: unresolved external symbol "public: virtual long __stdcall CBaseFilter::QueryVendorInfo(wchar_t * *)" (?QueryVendorInfo@CBaseFilter@@UAGJPAPA_W@Z)
1>dxfilter.obj : error LNK2019: unresolved external symbol "void __stdcall DbgBreakPoint(wchar_t const *,wchar_t const *,int)" (?DbgBreakPoint@@YGXPB_W0H@Z) referenced in function "public: virtual long __thiscall CTransInPlaceFilter::GetMediaType(int,class CMediaType *)" (?GetMediaType@CTransInPlaceFilter@@UAEJHPAVCMediaType@@@Z)
1>dxfilter.obj : error LNK2019: unresolved external symbol "public: __thiscall CTransInPlaceInputPin::CTransInPlaceInputPin(wchar_t *,class CTransInPlaceFilter *,long *,wchar_t const *)" (??0CTransInPlaceInputPin@@QAE@PA_WPAVCTransInPlaceFilter@@PAJPB_W@Z) referenced in function "public: __thiscall CDXFilterInPin::CDXFilterInPin(class CTransInPlaceFilter *,long *)" (??0CDXFilterInPin@@QAE@PAVCTransInPlaceFilter@@PAJ@Z)
1>dxfilter.obj : error LNK2019: unresolved external symbol "void __stdcall DbgAssert(wchar_t const *,wchar_t const *,int)" (?DbgAssert@@YGXPB_W0H@Z) referenced in function "public: struct tagAM_SAMPLE2_PROPERTIES * __thiscall CBaseInputPin::SampleProps(void)" (?SampleProps@CBaseInputPin@@QAEPAUtagAM_SAMPLE2_PROPERTIES@@XZ)
1>dxfilter.obj : error LNK2019: unresolved external symbol "public: __thiscall CMemAllocator::CMemAllocator(wchar_t *,struct IUnknown *,long *)" (??0CMemAllocator@@QAE@PA_WPAUIUnknown@@PAJ@Z) referenced in function "public: __thiscall CDXFilterAllocator::CDXFilterAllocator(class CDXFilterInPin *,long *)" (??0CDXFilterAllocator@@QAE@PAVCDXFilterInPin@@PAJ@Z)
1>dxfilter.obj : error LNK2019: unresolved external symbol "public: __thiscall CMediaSample::CMediaSample(wchar_t *,class CBaseAllocator *,long *,unsigned char *,long)" (??0CMediaSample@@QAE@PA_WPAVCBaseAllocator@@PAJPAEJ@Z) referenced in function "public: virtual long __thiscall CDXFilterAllocator::Alloc(void)" (?Alloc@CDXFilterAllocator@@UAEJXZ)
1>D:\Source\Source\SipPhoneWorkspace\Debug\mediastreamer2.dll : fatal error LNK1120: 9 unresolved externals
1>Build log was saved at "file://d:\Source\Source\Common\mediastreamer2\build\wince\Debug\BuildLog.htm"
1>mediastreamer2 - 10 error(s), 4 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
请各位大侠支招!!!
[解决办法]
一般都是缺少需要的库文件
你虽然添加了路径,但是有可能该路径下没有所需要的文件,或者有这个文件,但是版本不对。