I am using Visual Studio 2005 on XP SP3, 32-bit and I have some build problems
I want to do a simple task like playing an .avi file using direct show libraries, from Platform SDK
The project consists in only one source file:
CODE
#include <dshow.h>
void main(void)
{
IGraphBuilder *pGraph = NULL;
IMediaControl *pControl = NULL;
IMediaEvent *pEvent = NULL;
// Initialize the COM library.
HRESULT hr = CoInitialize(NULL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM library");
return;
}
// Create the filter graph manager and query for interfaces.
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void **)&pGraph);
if (FAILED(hr))
{
printf("ERROR - Could not create the Filter Graph Manager.");
return;
}
hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
// Build the graph. IMPORTANT: Change this string to a file on your system.
hr = pGraph->RenderFile(L"C:\\Example.avi", NULL);
if (SUCCEEDED(hr))
{
// Run the graph.
hr = pControl->Run();
if (SUCCEEDED(hr))
{
// Wait for completion.
long evCode;
pEvent->WaitForCompletion(INFINITE, &evCode);
// Note: Do not use INFINITE in a real application, because it
// can block indefinitely.
}
}
pControl->Release();
pEvent->Release();
pGraph->Release();
CoUninitialize();
}
And here are the errors:
1>play.obj : error LNK2001: unresolved external symbol _IID_IMediaEvent
1>play.obj : error LNK2001: unresolved external symbol _IID_IMediaControl
1>play.obj : error LNK2001: unresolved external symbol _CLSID_FilterGraph
1>play.obj : error LNK2001: unresolved external symbol _IID_IGraphBuilder
Note: dshow.h includes all needed headers and libraries like windows.h
CLSID_FilterGraph is defined in uuids.h like this:
CODE
// e436ebb3-524f-11ce-9f53-0020af0ba770 Filter Graph
OUR_GUID_ENTRY(CLSID_FilterGraph,
0xe436ebb3, 0x524f, 0x11ce, 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70)
Please help!