Link to home
Start Free TrialLog in
Avatar of fungi8210
fungi8210

asked on

Subject: Link error during object creation

I'm writing a directshow filter by extending CTransInPlaceFilter class. My
platform is Windows Mobile 6.0

my class constructor is as follows
CFPSFilter(TCHAR* tszName, LPUNKNOWN pUnk, HRESULT *phr) :
    CTransInPlaceFilter(tszName, pUnk, CLSID_CFPSFilter, phr)
{}

everything goes fine until i instantiate the class using this call inside
CreateInstance function
CFPSFilter *pFilter = new CFPSFilter(NAME("FPS Counter"), pUnk, pHr);

then build it, generates the following catastrophic errors

1>------ Build started: Project: CFPSFilter, Configuration: Debug Windows
Mobile 6 Professional SDK (ARMV4I) ------
1>Compiling...
1>CFPSFilter.cpp
1>Linking...
1>   Creating library Windows Mobile 6 Professional SDK
(ARMV4I)\Debug/CFPSFilter.lib and object Windows Mobile 6 Professional SDK
(ARMV4I)\Debug/CFPSFilter.exp
1>CFPSFilter.obj : error LNK2019: unresolved external symbol "public:
__cdecl CTransInPlaceFilter::CTransInPlaceFilter(wchar_t *,struct IUnknown
*,struct _GUID const &,long *)"
(??0CTransInPlaceFilter@@QAA@PA_WPAUIUnknown@@ABU_GUID@@PAJ@Z) referenced in
function "public: __cdecl CFPSFilter::CFPSFilter(wchar_t *,struct IUnknown
*,long *)" (??0CFPSFilter@@QAA@PA_WPAUIUnknown@@PAJ@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::NonDelegatingQueryInterface(struct _GUID
const &,void * *)"
(?NonDelegatingQueryInterface@CBaseFilter@@UAAJABU_GUID@@PAPAX@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual unsigned long __cdecl CUnknown::NonDelegatingAddRef(void)"
(?NonDelegatingAddRef@CUnknown@@UAAKXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual unsigned long __cdecl CBaseFilter::NonDelegatingRelease(void)"
(?NonDelegatingRelease@CBaseFilter@@UAAKXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::StreamTime(class CRefTime &)"
(?StreamTime@CBaseFilter@@UAAJAAVCRefTime@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::GetPinVersion(void)"
(?GetPinVersion@CBaseFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual int __cdecl CTransformFilter::GetPinCount(void)"
(?GetPinCount@CTransformFilter@@UAAHXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual class CBasePin * __cdecl CTransInPlaceFilter::GetPin(int)"
(?GetPin@CTransInPlaceFilter@@UAAPAVCBasePin@@H@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::Transform(struct IMediaSample *,struct
IMediaSample *)" (?Transform@CTransformFilter@@UAAJPAUIMediaSample@@0@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransInPlaceFilter::DecideBufferSize(struct
IMemAllocator *,struct _AllocatorProperties *)"
(?DecideBufferSize@CTransInPlaceFilter@@UAAJPAUIMemAllocator@@PAU_AllocatorProperties@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::StartStreaming(void)"
(?StartStreaming@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::StopStreaming(void)"
(?StopStreaming@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::AlterQuality(struct tagQuality)"
(?AlterQuality@CTransformFilter@@UAAJUtagQuality@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::SetMediaType(enum _PinDirection,class
CMediaType const *)"
(?SetMediaType@CTransformFilter@@UAAJW4_PinDirection@@PBVCMediaType@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::CheckConnect(enum _PinDirection,struct
IPin *)" (?CheckConnect@CTransformFilter@@UAAJW4_PinDirection@@PAUIPin@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::BreakConnect(enum _PinDirection)"
(?BreakConnect@CTransformFilter@@UAAJW4_PinDirection@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransInPlaceFilter::CompleteConnect(enum
_PinDirection,struct IPin *)"
(?CompleteConnect@CTransInPlaceFilter@@UAAJW4_PinDirection@@PAUIPin@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransInPlaceFilter::Receive(struct IMediaSample *)"
(?Receive@CTransInPlaceFilter@@UAAJPAUIMediaSample@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::EndOfStream(void)"
(?EndOfStream@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::BeginFlush(void)"
(?BeginFlush@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::EndFlush(void)"
(?EndFlush@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::NewSegment(__int64,__int64,double)"
(?NewSegment@CTransformFilter@@UAAJ_J0N@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CFPSFilter::Transform(struct IMediaSample *)"
(?Transform@CFPSFilter@@UAAJPAUIMediaSample@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::GetClassID(struct _GUID *)"
(?GetClassID@CBaseFilter@@UAAJPAU_GUID@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::Stop(void)"
(?Stop@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::Pause(void)"
(?Pause@CTransformFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::Run(__int64)" (?Run@CBaseFilter@@UAAJ_J@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::GetState(unsigned long,enum _FilterState
*)" (?GetState@CBaseFilter@@UAAJKPAW4_FilterState@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::SetSyncSource(struct IReferenceClock *)"
(?SetSyncSource@CBaseFilter@@UAAJPAUIReferenceClock@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::GetSyncSource(struct IReferenceClock * *)"
(?GetSyncSource@CBaseFilter@@UAAJPAPAUIReferenceClock@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::EnumPins(struct IEnumPins * *)"
(?EnumPins@CBaseFilter@@UAAJPAPAUIEnumPins@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CTransformFilter::FindPin(wchar_t const *,struct IPin *
*)" (?FindPin@CTransformFilter@@UAAJPB_WPAPAUIPin@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::QueryFilterInfo(struct _FilterInfo *)"
(?QueryFilterInfo@CBaseFilter@@UAAJPAU_FilterInfo@@@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::JoinFilterGraph(struct IFilterGraph
*,wchar_t const *)"
(?JoinFilterGraph@CBaseFilter@@UAAJPAUIFilterGraph@@PB_W@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::QueryVendorInfo(wchar_t * *)"
(?QueryVendorInfo@CBaseFilter@@UAAJPAPA_W@Z)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::Register(void)"
(?Register@CBaseFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2001: unresolved external symbol "public:
virtual long __cdecl CBaseFilter::Unregister(void)"
(?Unregister@CBaseFilter@@UAAJXZ)
1>CFPSFilter.obj : error LNK2019: unresolved external symbol "void __cdecl
DbgBreakPoint(wchar_t const *,wchar_t const *,int)"
(?DbgBreakPoint@@YAXPB_W0H@Z) referenced in function "public: virtual long
__cdecl CTransInPlaceFilter::GetMediaType(int,class CMediaType *)"
(?GetMediaType@CTransInPlaceFilter@@UAAJHPAVCMediaType@@@Z)
1>CFPSFilter.obj : error LNK2019: unresolved external symbol "public:
virtual __cdecl CTransformFilter::~CTransformFilter(void)"
(??1CTransformFilter@@UAA@XZ) referenced in function "public: virtual __cdecl
CTransInPlaceFilter::~CTransInPlaceFilter(void)"
(??1CTransInPlaceFilter@@UAA@XZ)
1>Windows Mobile 6 Professional SDK (ARMV4I)\Debug/CFPSFilter.dll : fatal
error LNK1120: 39 unresolved externals
1>Build log was saved at "file://d:\CFPSFilter\CFPSFilter\Windows Mobile 6
Professional SDK (ARMV4I)\Debug\BuildLog.htm"
1>CFPSFilter - 40 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

is there any reason why i am getting all these errors?
thanks!
ASKER CERTIFIED SOLUTION
Avatar of F. Dominicus
F. Dominicus
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of fungi8210
fungi8210

ASKER

hi, i just included the necessary libraries, and it solved the problem.
But the needed library to link was told by someone else, my problem is how do i know what library to link to since the error message does not give any indications.
>>>> my problem is how do i know what library to link
It is not so difficult. All standard libraries came with the compiler. 99% of these are in sub-directories called 'lib'. These paths automatically were searched when building a project. If you added own libraries you need to add the library paths to the export lib to the current linker settings. In Visual Studio it is in the Linker Settings - Additional Library Paths. There are also common library paths settings - if you need a path for more than one project - in Tools - Options - Directories - Library Directories. For makefiles or command line builds you may expand the environment variable LIB. If you added a third party product you also have to spot the lib subdirectory that comes with that product and add the include and lib paths accordingly. For dlls you need to expand the PATH environment variable.

If you get linker errors regarding unresolved externals you need to find out to what product the missing modules belong to. That normally isn't difficult cause you must have used these modules somehow from your code or the linker wouldn't complain. With the product name you go the docs and references and search for the missing module names. There you should find what library they belong to and can add the library to your linker settings.

Regards, Alex
>>>>>>how do i know what library to link to since the error message does not give any indications

this is the minimum that you should know as a developer of your application. Usually documentation is provided in any SDK about which libraries to use and their corresponding header files. At the minimum you should atleast go through these header files atleast to see the class hierarchies, methods provided etc...