Dev-Cpp w/ DirectDraw...

Started by
4 comments, last by KindFred 19 years, 4 months ago
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);
    }

}

Linux is like a Wig-Wam: no Gates, no Windows, Apache inside.
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
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. : )
K'-P = ME
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
Linux is like a Wig-Wam: no Gates, no Windows, Apache inside.
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
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.

This topic is closed to new replies.

Advertisement