Reputation: 27
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?
Upvotes: 0
Views: 718
Reputation: 69642
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.
Upvotes: 2
Reputation: 1332
these can be good reasons :
You are using CreateInstance but class which contains this is not exported in dll. i mean
class __declspec(dllexport) YourClass { .... }
you can check it by opening dll using notepad and search for 'CreateInstance', if it is not found then it is not exported to dll.
Upvotes: 1