Sign in to follow this  
Reaver1

Dev-Cpp w/ DirectDraw...

Recommended Posts

Well, I'm just trying to run DirectDraw in Dev-Cpp and I've the C++ DirectX SDK plus the runtime libraries, I link to ddraw.h, but it still says: [Linker error] undefined reference to `DirectDrawCreate@12' This is the part of code from an article on this site, coz I dunno any other good DirectDraw tutorials (that I could understand... I'm totally new to Win API and DirectX, coz I was using Allegro (NOT AllegroGL) all the time).... If anyone could help... :P
bool DirectDrawInit(HWND hwnd)
{
    HRESULT ddrval;
    
    ddrval = DirectDrawCreate( NULL, &lpDD, NULL );
    if( ddrval != DD_OK )
    {
        return(false);
    }

}

Share this post


Link to post
Share on other sites
ok, I am probably no the best one to know, I am just a beginner. but I think you need to link the library in addition to the headers, so it would be somethink like this:


#include <ddraw.h> //Include the header of direct draw

#pragma comment (lib, "dxguid.lib") //the directx guide library
#pragma comment (lib, "ddraw.lib") //the direct draw library.



I hope this will help you. : )

Share this post


Link to post
Share on other sites
Ah, yes, thx ;D

As I said I know some stuff in Allegro, so I used liballeg.a, but I was still trying to figure out how to make directdraw work with all those different tutorials, each one saying completely different stuff than the other one, thx again ;D

PLUS, I didn't even notice that I had such a thing as libddraw.a.... prolly because the lib files are listed first :|

;D

Share this post


Link to post
Share on other sites
Quote:
Original post by Dark Metamorphosis
ok, I am probably no the best one to know, I am just a beginner. but I think you need to link the library in addition to the headers, so it would be somethink like this:

*** Source Snippet Removed ***

I hope this will help you. : )


I don't think those type pragmas work in MinGW32. I was reading the documentation about it the other day, and that's what it said. If you don't know how to link...

First you need to #include <ddraw.h>, then in your project options, you add -ldraw, or click on the browse type button and select libddraw.a

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this