C++ School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a C++ Expert!

Join 300,490 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 1,814 people online right now. Registration is fast and FREE... Join Now!




Visual Studio 2005

 

Visual Studio 2005, I have some problems using directShow

aelveon

3 Jul, 2009 - 12:44 PM
Post #1

New D.I.C Head
*

Joined: 3 Jul, 2009
Posts: 3

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!

User is offlineProfile CardPM
+Quote Post


Martyr2

RE: Visual Studio 2005

4 Jul, 2009 - 10:37 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 7,246



Thanked: 820 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
Have you linked strmiids.lib to your project? This file will mport all the DirectShow GUIDs that the project uses. Typically when you get these errors that is the problem. Linking that in will solve the problem most of the time.

smile.gif
User is offlineProfile CardPM
+Quote Post

aelveon

RE: Visual Studio 2005

5 Jul, 2009 - 03:52 AM
Post #3

New D.I.C Head
*

Joined: 3 Jul, 2009
Posts: 3

QUOTE(Martyr2 @ 4 Jul, 2009 - 10:37 PM) *

Have you linked strmiids.lib to your project? This file will mport all the DirectShow GUIDs that the project uses. Typically when you get these errors that is the problem. Linking that in will solve the problem most of the time.

smile.gif


I realised at some point I have to link a library but I didn't know which one. It worked with that one, thank you.
Now there's another problem: I tried one of the direct show samples and I get another build error: error C3861: 'CoInitializeEx': identifier not found. I guess I have to link another library, but which one? Or...is there a way I can find the needed libraries for anything?
I only want to get an .avi file to play in fullsreen mode in my directX game. Maybe there is another easier way to do it...but I really need to get it working these days.

User is offlineProfile CardPM
+Quote Post

Reply to this topicStart new topic

Time is now: 11/8/09 04:22AM

Live C++ Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month