i am writing a program to capture video from my webcam. every thing is fine except that the compiler gives error for ICaptureGraphBuilder2 *pCaptureGraphBuilder2.
error C2065: 'ICaptureGraphBuilder2' : undeclared identifier
i am using VC++ 6.0
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 7 of 7
Thread
-
-
More information please.
What SDKs do you have installed? You are probably missing strmif.h (or, if you have the right SDK, just haven't included it. Once you do, you'll probably get a whole load of missing symbol errors when linking, too).
Is that the only error you get?
Can you post your code and all the compiler output? It's hard to tell what's going wrong without it. -
i have installed DirectMedia SDK 6.0
#include<stdio.h>
#include<dshow.h>
#include<strmif.h>
void main()
{
ULONG nFetched = 0;
IGraphBuilder *graphb;
ICaptureGraphBuilder2 *pCaptureGraphBuilder2;
IMediaControl *mediac;
ICreateDevEnum *listofdevices;
IEnumMoniker *devicecategory;
IMoniker *monik;
IPropertyBag *pPropertyBag;
IBaseFilter *filter;
CoInitialize(NULL);
CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INP ROC,IID_IGraphBuilder,(LPVOID*)&graphb);
CoCreateInstance(CLSID_CaptureGraphBuilder2,NULL,C LSCTX_INPROC,IID_ICaptureGraphBuilder,(LPVOID*)&pC aptureGraphBuilder2);
graphb->QueryInterface(IID_IMediaControl,(LPVOID*)&mediac );
CoCreateInstance(CLSID_SystemDeviceEnum,NULL,CLSCT X_INPROC,IID_ICreateDevEnum,(LPVOID*)&listofdevice s);
listofdevices->CreateClassEnumerator(CLSID_VideoInputDeviceCateg ory,&devicecategory,0);
while (devicecategory->Next(1, &monik, &nFetched) == S_OK)
{
TCHAR devname[128];
monik->BindToStorage(0, 0, IID_IPropertyBag,(void **)&pPropertyBag);
VARIANT varFriendlyName;
varFriendlyName.vt = VT_BSTR;
pPropertyBag->Read(L"FriendlyName", &varFriendlyName, 0);
#ifdef UNICODE
_tcscpy(devname, varFriendlyName.bstrVal);
#else
WideCharToMultiByte(CP_ACP, 0,varFriendlyName.bstrVal, -1, devname, sizeof(devname), 0, 0);
#endif
puts(devname);
VariantClear(&varFriendlyName);
monik->BindToObject(0, 0, IID_IBaseFilter,(void**)&filter);
monik->Release();
pPropertyBag->Release();
break;
}
pCaptureGraphBuilder2->SetFiltergraph(graphb);
graphb->AddFilter(filter, L"Device Filter");
pCaptureGraphBuilder2->RenderStream(&PIN_CATEGORY_PREVIEW,NULL, filter, NULL,NULL);
mediac->Run();
Sleep(100000000);
graphb->Release();
mediac->Release();
devicecategory->Release();
listofdevices->Release();
CoUninitialize();
}
errors :
error C2065: 'ICaptureGraphBuilder2' : undeclared identifier
error C2065: 'pCaptureGraphBuilder2' : undeclared identifier
error C2065: 'CLSID_CaptureGraphBuilder2' : undeclared identifier
error C2227: left of '->SetFiltergraph' must point to class/struct/union
error C2227: left of '->RenderStream' must point to class/struct/union
Error executing cl.exe. -
Your SDK is out of date.
You need the current version of the DirectShow SDK. This is part of the latest Platform SDK or Windows SDK (they are different). Don't download the DirectX SDK - all the DirectShow stuff has been removed. -
first of all thx for ur response.
i hve downloaded a new strmif.h from www.koders.com
the problem has solved but now it gives other errors
: error C2146: syntax error : missing ';' before identifier 'HSEMAPHORE'
: fatal error C1004: unexpected end of file found
when i click the errors it takes me to strmif.h file.
what is this ? -
You need the current Windows Software Development Kit or Platform Software Development Kit. It contains everything that is required for DirectShow applications including lots of examples showing what libraries are needed etc. They come with Visual Studio solutions but they may not open in 6.0.
I recommend the Platform SDK:
http://www.microsoft.com/downloads/details.aspx?FamilyId=484269E2-3B89-47E3-8EB7-1F2BE...displaylang=en
It's big - 400MB but smaller than the other one (1.1GB).
Once installed, you will need to add the DirectShow base libraries and includes to your paths.
C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Multimedia\DirectShow\BaseClasses
Similar Threads
-
DVD FLICK, Start-up Error Msg-Unable to created txt file. Last DLL error: 5
By jacknscoob in forum Authoring (DVD)Replies: 5Last Post: 4th Mar 2012, 08:58 -
Error: The source image format is not acceptable (error code -2)
By Russo in forum DVD RippingReplies: 3Last Post: 5th Jul 2011, 10:50 -
DVD Shrink Error: Programing Error, exception occurred
By lapetite_66 in forum DVD RippingReplies: 5Last Post: 2nd Jun 2010, 15:59 -
Error with Xvid4PSP when converting MKV to AVI (VirtualDub Error)
By Peter25 in forum Newbie / General discussionsReplies: 1Last Post: 9th Apr 2009, 18:10 -
Get many error messages, AviSynth error message and meGUI error
By MKVcrazy in forum Video ConversionReplies: 0Last Post: 25th Aug 2007, 16:41