Archived

This topic is now archived and is closed to further replies.

DirectDrawCreate( )

This topic is 5635 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

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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 ).

Share this post


Link to post
Share on other sites