Archived

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

masque01

directdraw/"tricks of the windows game programming gurus"

Recommended Posts

masque01    122
Hi Everyone, Any help I could get on this would be very... helpful. I'm going through LaMothe's book, "tricks of the windows game programming gurus", and I've run into a snag initializing directdraw. The error occurs from this line where I'm doing DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL); - btw, I'm doing this command in error checking code - and when I try to compile, I get an unresolved external resource (lnk 2001). There is a space in the book that says "I get 10 emails a day from rookies who forget to include the .lib" Well, I've included the right .lib directory in the compiler options (and the right include directory) and I tried (just randomly) putting hte ddraw.lib file in the directory I'm compiling in (and ddraw.h, just hoping). All of this gave me the same error. BUT, if I purposefully change IID_IDirectDraw7 to something else it says "undeclared identifier". when I try to compile.. so it recognizes IID_IDirectDraw7, but still has problems. Anyone know where I'm going wrong? I appreciate any help. James ps- I'm using MSVC++ 6.0 and DirectX 9 (which came with ddraw.lib, ddraw.h.. might this be the problem? version issues?) [edited by - masque01 on March 21, 2004 12:48:18 PM]

Share this post


Link to post
Share on other sites
yspotua    122
I could be wrong, but I remember that book was written for DirectX 6 or 7. The DirectX 9 SDK doesn't have interfaces for DirectDraw.

You need to find and download the older SDK in order for that code to work.

[edited by - yspotua on March 21, 2004 12:59:54 PM]

Share this post


Link to post
Share on other sites
masque01    122
thats what I thought might be the problem, but dx9 SDK comes with ddraw.lib and ddraw.h and support for all its data structures which is what made me think I was going to be okay. That, and Ddraw was dropped in dx8, and the book comes with dx8.1 sdk. Maybe this would be better in the DirectX forum, if the moderator wants to move it.

[edited by - masque01 on March 21, 2004 1:26:48 PM]

Share this post


Link to post
Share on other sites
yspotua    122
quote:
Original post by masque01
thats what I thought might be the problem, but dx9 SDK comes with ddraw.lib and ddraw.h and support for all its data structures which is what made me think I was going to be okay. That, and Ddraw was dropped in dx8, and the book comes with dx8.1 sdk. Maybe this would be better in the DirectX forum, if the moderator wants to move it.




You might also try Lamothe''s site: http://www.xgames3d.com/

Share this post


Link to post
Share on other sites
masque01    122
quote:
Original post by DukeAtreides076
Have you defined INIT_GUID or linked with dxguid.lib?


I've defined INIT_GUID. I actually called it INITGUID, following the book. Does order matter? I did it right under WIN32_LEAN_AND_MEAN. Also, there are no references to INITGUID except the #define, should there be?

About linking dxguid.lib, it's in the directory I've specified for libraries. (tools/options/directories/libraries) Is there something else I should be doing?

Maybe if I posted the source?

[edited by - masque01 on March 21, 2004 2:06:42 PM]

[edited by - masque01 on March 21, 2004 2:07:23 PM]

Share this post


Link to post
Share on other sites
QzarBaron    370
No it has nothing to do with the fact that you are running DX 9.
The ddraw.lib is the same on 7, 8, and 9. its hard to tell what your problem is. i have the book and i compile programs with that code all the time. What i do to include the ddraw.lib file is to go to project->addexistingfile->and go to the folder where the files you need are. all you have to do then is make sure at the bottom you have All Files and add the .lib. that is what i do and it works fine.

Share this post


Link to post
Share on other sites
masque01    122
quote:
Original post by QzarBaron
No it has nothing to do with the fact that you are running DX 9.
The ddraw.lib is the same on 7, 8, and 9. its hard to tell what your problem is. i have the book and i compile programs with that code all the time. What i do to include the ddraw.lib file is to go to project->addexistingfile->and go to the folder where the files you need are. all you have to do then is make sure at the bottom you have All Files and add the .lib. that is what i do and it works fine.


Before, I had done that only to ddraw.lib and still got the error.. but then I did it to dxguid.lib and it compiled fine. I figured this out and compiled it, as I was hitting refresh on this screen and your reply was there. Would have been helpful Actually, thanks everyone.

Share this post


Link to post
Share on other sites