I think I´ve read about everything concerning this error here at stackoverflow, but I cannot solve my problem: I have the DirectShow PushSource Filter sample project (.dll) which I managed to build in VS2013 and also a test project in another sln which is using some methods from the PushSource.dll. I linked the lib and everything but cannot get rid of this Linker error:
FilterGraphTestApp.obj : error LNK2019: unresolved external symbol "public: static class CUnknown * __stdcall CPushSourceBitmapSet::CreateInstance(struct IUnknown *,long *)" (?CreateInstance@CPushSourceBitmapSet@@SGPAVCUnknown@@PAUIUnknown@@PAJ@Z) referenced in function _main
code calling the CreateInstance member:
// Get the interface for DirectShow's GraphBuilder
IUnknown *pUnk = NULL;
HRESULT *pHr = NULL;
CBaseFilter *pPSBS = (CBaseFilter*)CPushSourceBitmapSet::CreateInstance(pUnk, pHr);
pGB->AddFilter(pPSBS, L"ImagesToVideoFilter");
pGB->QueryInterface(IID_IMediaControl, (void **)&pMC);
pMC->Run();
Code of the calling funtion:
CUnknown * WINAPI CPushSourceBitmapSet::CreateInstance(IUnknown *pUnk, HRESULT *phr)
{
CPushSourceBitmapSet *pNewFilter = new CPushSourceBitmapSet(pUnk, phr );
if (phr)
{
if (pNewFilter == NULL)
*phr = E_OUTOFMEMORY;
else
*phr = S_OK;
}
return pNewFilter;
}
Any hints what else I could try?
Sample project produced you a DLL. You are not supposed to link it or associated LIB with your test application (FilterGraphTestApp). Trying to resolve quoted LNK2019 will get you nowhere.
Instead you are supposed to register the DLL so that it populates itself into list of registered DirectShow filters. Then you instantiate it from there interactively using GraphEdit, or programmatically using CoCreateInstance
API and respective CLSID (alternatively you can use moniker).
You can bypass COM registration too and include PushSource header file to share some declarations, for for starters this could be left alone. To use CPushSourceBitmapSet::CreateInstance
you won't need the DLL, LIB of the sample project. Neither you need the sample project, except that you would borrow source code from there into your own application and link files from BaseClasses directory (or LIB resulting from their build) to get the implementation right into your application without a DLL. This way CreateInstance
would work.