DirectX Questions... Problems with .lib and ddraw.h

Hi,

... ... ... I use the Visual Studio 2005 Standard Edition, Visual C++ 2005... I've done some Windows programming and been using the GDI to make some graphics so far, it works well... But can anybody tell me how to Clear the screen after using the GDIs to draw some polygons... You see, the screen then becomes full of polygons, and that's what was wanted, but then, finally, how about Clearing the Screen completely and then start to draw some other, say, triangles instead... So, What is the exact Command to Clear that Window that the polygons were drawn in...?

... ... ... OK, Now, here's the problems... I've finally started to get into Direct3D and DirectX... So, I've read and Understood all the materials about how to create Primary Buffers, Secondary Buffers, how to link the Primary Buffer to the Video Ram for immediate display, and all the other necassary interfaces and some COM stuffs... Everything went well, up until I started to compile a program... Says I've got to #include <ddraw.h>, so that's fine... And of course then, got to input the .lib files to the Compiler's linker... So, I did that, says those are those below...

ddraw.lib

dinput.lib

dinput8.lib

dsound.lib

d3dim.lib

dxguid.lib

winmm.lib

and all the #includes in the program are those below...

#define WIN32_LEAN_AND_MEAN// just say no to MFC

#define INITGUID// make sure directX guids are included

#include<windows.h>// include important windows stuff

#include<windowsx.h>

#include<mmsystem.h>

#include<iostream>// include important C/C++ stuff

#include<conio.h>

#include<stdlib.h>

#include<malloc.h>

#include<memory.h>

#include<string.h>

#include<stdarg.h>

#include<stdio.h>

#include<math.h>

#include<io.h>

#include<fcntl.h>

#include<ddraw.h>// include directdraw

... ... ... But everytime I compile the program, the Compiler keeps telling me that it Can't find or Can't open any of the .lib files except for the winmm.lib , this one is ok...

Now, of course, I've also followed instructions as I knew before to set the include directories of the DirectX SDK on top in the Tools/Options/VC++ Directories and as well for the libraries directories on top and the bin directories on top, so everything were done as instructed...

... ... ... But I wonder if there are other #include <>s that should have been added or that those .lib files I mention above are out of date and so they should be of different names, so then, Please tell me what should they have been...? Also, any other #include <>s that should be added...?

[4798 byte] By [Hello_Yo] at [2007-12-25]
# 1
it sounds like you have not added the dx9 sdk include and linker paths. go to Extras|Options|Project and Solutions|VC++ Directories and then add the directories (i.e C:\Program Files\Microsoft DirectX 9 SDK (August 2006)\Include and Lib) in the respective categories (note that I have a German Visual Studio and I might have done mistakes when backtranslating the menu names).
linqs at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 2
The libs you're linking against are really outdated... (d3dim.lib ?!!)
For a legacy DirectDraw application, you only need to #include <ddraw.h> and link to
ddraw.lib (and probably dxguid.lib in a certain case). All the other libs are not required...

On a second note, you should really consider moving to D3D9 now instead of using DDraw.

Oh, and about that GDI clear question, you can always use FillRect() to clear your screen to the color or hatch you like...

WessamBahnassi at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 3

Hi,

... ... ... Dear linqs,

It's just that the program that I'm creating does only need Direct3D up to Version 7.0, so Certainly Not Yet DirectX 9.0 SDK... But again, you might be a more experienced guy about those subject... Really, how do I solve this problem...? The compiler would not recognize NONE of the .lib that I input to the linker, none of them except winmm.lib ... If you really know much something, please reply and let me know as soon as possible...?

Hello_Yo at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 4

Hi,

... ... ... Dear Wessam Bahnassi,

I will try the FillRect() function pretty soon to see if it would work... But again, I use the Visual Studio 2005 Standard Edition, and they say it has just the latest version of Visual C++ 2005 and SDK... But you see, I used the Windows Explorer and looked everywhere to find the ddraw.lib file Myself, and IT Was Nowhere to be found in any of the SDK or Visual Studio 8 Folders or Subfolders in any way what so ever... What's really seems to be the thing, really about this...?

You see, I'm able to #include the <ddraw.h>, that's fine... But when I try to Only Input the ddraw.lib to the linker, the compiler, as usual, keeps telling me that it cannot find or can't Open the ddraw.lib file... So, now, WHAT then...? Is there another setting that I'm not aware of...? Or maybe, could you tell me what are the Exact Directories of include, libraries and bin in the Tool/Options/VC++ Directories that I should put at the top...? Otherwise, then, what seems, do you think, would be the solution then...?

Hello_Yo at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 5
DDraw is not included with VS2005 anymore. But you can still get it from the DirectX SDK (it's still there even in the current August 2006 SDK). You should find it in your SDK's Lib directory. If it's not there, then you have a bad DirectX SDK installation...
WessamBahnassi at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 6

Hi,

... ... ... Dear Wessam Bahnassi,

Well, I'm having problems downloading the DirectX 9.0 SDK... I only have dial up... Gonna take Forever... But anyway, There should be other #includes and .lib files that I can use for my programs... I'm using the Vidual Studio 2005 Standard Edition Full Version... They told me that's the latest of everything, with the DirectX 9.0SDK or SD, whatever it is, there should be other Names of the files that I can use that would be just as useful, don't you think... So, Could you Please tell me What they Are...?

Hello_Yo at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 7

What do you mean "other names of the files that would be just as useful?"...

WessamBahnassi at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 8

Hi,

... ... ... Dear Wessam Bahnassi,

Well, allright... Some other #include <> Headers and with their Corresponding .lib files that were supposed to be for the DirectX upgrades... Since, thy're Not using the Ones I mentioned, there must be the Other Ones that they Developped ever since that time... Those that would do, Prability, Better...

And beleive me, I did Reinstall the Visual Studio 2005, all of it... I don't think that those #include files Nor the .lib files are anywhere near in the SDK Directories... I think this problem isn't going to be solved by looking for them... I should just use those Other Ones that are the Upgrades that they Wrote in the Newer SDKs...

So, Could you tell me, according to what you see in the Codes above, Which Ones would Really be Replacing them...?

Hello_Yo at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 9
I already told you in my first reply that you should use D3D9 nowadays. Grab a DirectX 9 SDK from somewhere and install it. Earlier DX9 SDKs were smaller in size than current ones, but they're still over 300 megs anyways... Sorry, can't help you with this one...
WessamBahnassi at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 10

Hi,

... ... ... Oh, by the way, know any Other Third Parties or Retailers that would Sell or Distribute that SDK on CD... Tell me their names and I'l call them up front... Thanks and warpspeed...

Hello_Yo at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 11

Hi,

... ... ... Which ONES, DirectX 9 SDK...? The VS2005 COMES with DirectX 9.0 SDK Already, my Friend... And, so Didn't you know that...? Or, do you mean then, logically, that The Latest August 2006 DirectX SDK would be the one that They, whoever they are, have decided to AT LEAST Put the ddraw.lib and ddraw.h into the August 2006 DirectX SDK, Because you know, my friend, the VS2005 Already has a SDK, and Microsoft told me that it's the DirectX 9.0 SDK... So, since you're telling me that the DirectX 9 SDK is larger, then, does that mean, it will AT LEAST be containing a ddraw.lib and ddraw.h in IT...? Well...?

Hello_Yo at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 12

I'm not sure who told you that VS2005 comes with the DirectX SDK, it doesn't.

However you say you have the .h files but not the .lib files, I'm not sure how you got the .h files though.

The only way to get the Directx SDK on disc is to get an MSDN subscription. The DirectX in MSDN subscription is usually 2 months behind (so the August SDK is currently in the subscription). Or you need to find a friend with a faster connection and download it.

Since you want an old version of the SDK you might try to find an old DirectX book with a CD in it - lots of those still have DirectX7 install files but note that its no longer supported.

TheZMan at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 13

Hi,

... ... ... Dear The ZMan,

Ok, then, does that mean that the Representative of Microsoft Presale and Info told me the wrong Information...? So, therefore, Definitely, the VS2005 Does Not contain any DirectX 9.0 SDK, Right...? But, you see, When I look in the Folders and Subfolders in the VS2005 in my harddrive, I do see Many SDK Folders and Subfolders, so what really are those Exactly...? So, anyway, Is the Visual C++ 2005 Newer than the Visual C++ 6.00...? Because that's also what the Microsoft Rep told me, so do you know...?

Hello_Yo at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...
# 14

Hi,

... ... ... Dear The ZMan,

Alright, I found out that I already have the DirectX SDK August 2006... So therefore, when I input all those .lib files, they all worked Except the d3dim.lib, I wonder why, Could you tell me why...?

And again, when I compiled the program, the compiler is still telling me that there are 2 Errors...

Now, here's the code of the Function that seems to be the problem that the compiler Does Not recognize...

LPDIRECTDRAW7 lpdd = NULL; // dd object

// create IDirectDraw interface 7.0 object and test for error

if (FAILED(DirectDrawCreateEx(NULL, (void **)&lpdd, IID_IDirectDraw7, NULL)))

return(0);

And here below are the Errors Messages that the compiler displays...

1> Build started: Project: Chapter 6, Configuration: Debug Win32

1>Compiling...

1>Demo6_3.cpp

1>c:\documents and settings\ly heu\my documents\c++ codes\chapter 6\chapter 6\demo6_3.cpp(95) : warning C4101: 'buffer' : unreferenced local variable

1>c:\documents and settings\ly heu\my documents\c++ codes\chapter 6\chapter 6\demo6_3.cpp(399) : warning C4244: 'return' : conversion from 'WPARAM' to 'int', possible loss of data

1>c:\documents and settings\ly heu\my documents\c++ codes\chapter 6\chapter 6\demo6_3.cpp(330) : warning C4101: 'hdc' : unreferenced local variable

1>Linking...

1>Demo6_31.obj : error LNK2019: unresolved external symbol _DirectDrawCreateEx@16 referenced in function "int __cdecl Game_Init(void *,int)" (?Game_Init@@YAHPAXH@Z)

1>C:\Documents and Settings\Ly Heu\My Documents\C++ Codes\Chapter 6\Debug\Chapter 6.exe : fatal error LNK1120: 1 unresolved externals

1>Build log was saved at "file://c:\Documents and Settings\Ly Heu\My Documents\C++ Codes\Chapter 6\Chapter 6\Debug\BuildLog.htm"

1>Chapter 6 - 2 error(s), 3 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Please tell me what's really going on...? If you know...? Or what should I really have changed in the codes...?

Hello_Yo at 2007-9-3 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: DirectX 101...