Advertisement

DirectDrawCreate( )

Started by August 12, 2002 10:52 PM
3 comments, last by Mikey21 22 years, 3 months ago
Okay, I''m trying to learn DirectDraw. I know how to create and destroy a DirectDraw object, but for some reason when I try to build it (it compiles just fine) I get an error message like... "...unresolved externals DirectDrawCreate@12..." or something like that. Here is my code... #include <ddraw.h> //blah blah blah LPDIRECTDRAW lpdd; //blah blah blah Game_Init(void *parms) { if (DirectDrawCreate(NULL,&lpdd,NULL)!=DD_OK) return 0; return 1; } Game_Shutdown(void *parms) { if (lpdd!=NULL) lpdd->Release(); return 1; } This is from program 8_1 in "Windows Game Programming For Dummies" in case you want to see the whole code. Please tell me what the problem is and how I can fix it. Thanks.
I don;t know if this is the problem but your using LPDIRECTDRAW lpdd; instead of LPDIRECTDRAW7 lpdd.

And your using DirectDrawCreate instead of DirectDrawCreateEx.
Advertisement
Are you compiling with the ddraw.lib library? If you just include the headers it won''t work, you need to include the library as well.
After your headers, include the lines..

#pragma comment (lib,"dxguid.lib")
#pragma comment (lib,"ddraw.lib")

If your paths are set up correctly, this will include the libraries necessary.
DirectDrawCreate() can be used instead of DirectDrawCreateEx() if you''re using LPDIRECTDRAW instead of LPDIRECTDRAW7, so it''s no problem here.

Well, like "Unwise Owl" said u should include the ddraw.lib in your project like this [Project]->[Settings]->[Link] (assuming that ur using Visual c).
And u should not forget to tell the compiler where to find files like ddraw.h . Also assuming that u''r using Vc, click on [Tools]->[Options]->[Directories] and there set the directories.

For more help, u can just make a search on this site, many guys have already ask this kind of questions( including me ).
"...and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces."----------Scott Meyers, "Effective C++"

This topic is closed to new replies.

Advertisement