• Advertisement
Sign in to follow this  

Dev-Cpp w/ DirectDraw...

This topic is 4837 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
ddraw.h is a header, not a library. The libray files are the libxxx.a files. The one you are looking for is libddraw.a

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
since we're getting all anal up in here, add -lddraw to the linker text list of the parameters tab of the project options dialog.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement