• ### Announcements

• #### Wondering what's new and changed at GameDev.net?06/20/17

Check out the latest Staff Blog update that talks about what's changed, what's new, and what's up with these "Pixels".

#### Archived

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

# 02.07 - The Readiness Test

## 215 posts in this topic

Fighterdude: Sorry for the bad error reporting, but it''s a lot better than I had it (returned FALSE on failures). The idea here was to give you a clue as to the nature of the error by letting you manually ''look it up'' in the source code. Not to worry though, I''m definitely introducing real debugging facilities in a future article.

As for the documentation, I recommend the online help because then you could look up a component, method, constant or whatever instantly using the help''s indexing feature. There''s nothing stopping you from grabbing both however (they''re identical though).

Mucman: No, you don''t need to understand ANYTHING in the template code. The goal here is to get it compiling and linking, and that''s it. Don''t worry, I''ll break it to ya gently...

Higgenkreuz: For the DLLs, you should download the newest runtimes from Microsoft (DirectX for home users).

Teej

0

##### Share on other sites
I have a quick question...

In Globals.h, the DirectDraw surfaces are declared using LPDIRECTDRAWSURFACE7. However, in the utilities functions you use IDirectDrawSurface7*. What''s the difference?

Hah Coe
hahcoe@yahoo.com
0

##### Share on other sites
Here is an odd one, it complies and links find for me but I cannot run it. It comes up, changes to full screen, and closes. Very odd.
0

##### Share on other sites
Hah Coe: If you look at the definition of LPDIRECTDRAWSURFACE7, you''ll see that it''s a (far) pointer to a IDirectDrawSurface7 object. In other words, they''re virtually the same thing. Take a look at some of these definitions (from WINDEF.H):

  typedef unsigned long DWORD;typedef int BOOL;typedef unsigned char BYTE;typedef unsigned short WORD;typedef float FLOAT;typedef FLOAT *PFLOAT;typedef BOOL near *PBOOL;typedef BOOL far *LPBOOL;typedef BYTE near *PBYTE;typedef BYTE far *LPBYTE;typedef int near *PINT;typedef int far *LPINT;typedef WORD near *PWORD;typedef WORD far *LPWORD;typedef long far *LPLONG;typedef DWORD near *PDWORD;typedef DWORD far *LPDWORD;typedef void far *LPVOID;typedef CONST void far *LPCVOID; typedef int INT;typedef unsigned int UINT;typedef unsigned int *PUINT;

As you can see, there are a lot of different ways of talking about the same ''thing''. For instance, I can use

void *lpVoid;

for a void pointer, or just the same:

LPVOID lpVoid;

(ignore near and far). You do have a point in that I should be more consistent, but at the same time one is just an alias for another, so it''s only a readability issue.

All the same, thanks for the nudge -- I think I might ''fix'' that after all.

Teej

0

##### Share on other sites
Teej,

I was just interested about how you set up your globals header and was wondering why you use the following code and put alot of the direct x global variables in a structure. There arent many tutorials explaining how to seperate your code into different source files and get it to work and I was just wondering if this was the key i''ve been looking for...BTW thanks for the good ideas!

// Global Variables
//----------------------------------------------------------------------------

#ifndef GLOBALS_OWNERSHIP
extern
#endif

struct
{

Thanks,
MikeD
0

##### Share on other sites
I''m trying to compile the basecode under Borland C++ Builder 4, but i keep getting these errors:

[Linker Error] Unresolved external ''_IID_IDirectDraw7'' referenced from C:\CG\HANDSON\PROJETO\BASECODE1\INITTERM.OBJ.
[Linker Error] Unresolved external ''DirectDrawCreateEx'' referenced from C:\CG\HANDSON\PROJETO\BASECODE1\INITTERM.OBJ.
[Linker Error] Unresolved external ''_IID_IDirectInput7A'' referenced from C:\CG\HANDSON\PROJETO\BASECODE1\INITTERM.OBJ.
[Linker Error] Unresolved external ''DirectInputCreateEx'' referenced from C:\CG\HANDSON\PROJETO\BASECODE1\INITTERM.OBJ.
[Linker Error] Unresolved external ''_IID_IDirectInputDevice7A'' referenced from C:\CG\HANDSON\PROJETO\BASECODE1\INITTERM.OBJ.
[Linker Error] Unresolved external ''_c_dfDIKeyboard'' referenced from C:\CG\HANDSON\PROJETO\BASECODE1\INITTERM.OBJ.

All my .h and .lib seems to be Ok. Does anyone have any idea about what can be happening?
0

##### Share on other sites
luizh:

Did you link dxguid.lib into your program?
0

##### Share on other sites
Darkpunk: I''ll be discussing that little ''technique'' in an article coming up shortly, but I can tell you that it''s a nice way of organizing globals. One of the really frustrating things when dealing with multiple headers/source files is keeping the compiler/linker happy, and this method sure helps.

Teej

0

##### Share on other sites
Hiya all!
I just got the whole thing to compile, link, and run with the free Borland 5.5 compiler and VIDE. It only took me about 12 hours . If anyone needs help with 5.5 and VIDE will do my best to help out. It was in the end very simple to do. Have Fun!

Mogrem
0

##### Share on other sites
Yeah globals are really rough, and id love to figure that out since it would be really useful for when i''ve developed my own dx functions and want to make a seperate file to include in future games.

I cant wait to read the article!! Will this way of global defining also work when attempting to make a *.lib file? I was trying to compile my dx init stuff into one lib so i can constant reuse it with all my idea testing programs. It gets monotonous to type out winapi a billion times as well as dx objects.

Anyway, i look forward to reading more of this forum.

MikeD
0

##### Share on other sites
Hooray! Compiled and linked and ready to rock.
0

##### Share on other sites
weatherman:

hey, thx for the tip! i forgot to link some libs (ddraw.lib, dxguid.lib and c_dinput.lib). Now its really working! thx again.

HAUHUAHUAHUAHAUHA now i''m ready....
0

##### Share on other sites
I couldn''t get your BaseCode1 working.
Probably because I don''t have Directx7 SDK installed.
Could someone give me a URL for this? I can''t find it.

Also, I am using MSVC++ 6 and found that it has its own default "ddraw.h", "dsound.h" and "dinput.h" header files. What versions are these? Can we use these? I found that some functions had different name and different parameter lists to what TeeJ had used.
e.g. ''LPDIRECTDRAW7'' would be ''LPDIRECTDRAW''

I know next to nothing about DirectX so this is probably be silly question but I''d be grateful if someone could answer my questions nonethless...

Go Blazers~~!!!
0

##### Share on other sites
pippen33: what you see are old verions of directx files. you can get the newest files at www.microsoft.com/directx. you need to download the directx 8 sdk and runtime files.
0

##### Share on other sites
OK, now I am getting desperate. I still have the same problem:

d:\dxvcsdk\lib\ddraw.lib : fatal error LNK1106: invalid file or disk full: cannot seek to 0x389bc793

Here are the steps I have taken so far to solve this problem:

• Checked HD, it is not full

• Moved ddraw.lib and its directory to a different HD to make sure that my HD wasn't damaged, had bad blocks, etc.(made appropriate changes in my IDE to reflect these changes)

• Re-downloaded and re-installed the entire SDK (ver 8.0) as well as the run-time libraries (ver 8.0a)to ensure that none of the files are corrupt in the kit.

• Read countless articles and postings on the Net, still found no reasonable explication

I am using MS Visual C++ 5.0 with the minimum installation configuration, so some of my /lib and /include directories as well as other misc. stuff are running from the CD-Rom. I heard that if the .lib file was compiled using VC 6.0 and you are still using VC 5.0 you might run into this problem. I doubt it though, I imagine many of you are using VC 5.0 with the DirectX SDK ver 8.0 and nobody seems to have this problem.

Anyway, ANY idea would be greatly appreciated as I am running out of them and don't know what else to do, I am really stuck.

Edited by - Higgenkreuz on April 26, 2001 10:52:59 AM
0

##### Share on other sites
Is D your CD-Drive and what exatly r u running from the CD?

-- Sturm

---------------------------------------------------
Life after death? No thanks, I want to live NOW
--- Sturm 2001
0

##### Share on other sites
I am getting the same problem as you, higgencreuz. I'm not so sure that it is a problem with ddraw.lib. Maybe VC is playing up. If you find out what the problem is then can you please email it to me. Or even post the solution here...

Thanks a lot.

System: VC++5 (fully installed to HD)

HEEEEELLLLLLLPPPPPPP!!!!!!!!!

John

Edited by - polomint on April 26, 2001 2:17:02 PM
0

##### Share on other sites
Hmm, sounds like a hard problem.

From what I can gather, it seems as if the LIB file doesn''t contain the interface that the header file is describing. Give this a try: I''m going to throw the EXE for BaseCode1, and let''s see if you guys can get it running. Head over here and grab it.

Let us know...in the meantime, I''ll keep looking into it.

Teej
0

##### Share on other sites
I''ve tried the bascode1 exe file on your website Teej, but all I get is the error message...

ERROR
DD_Init Failes : 7

I''ve tried re-installing the DX8 runtime, restarted system numerous times, but still it won''t work....

Good luck finding this problem.

One question though. Does this problem arise just with VC5? or does it also happen with VC7/BC5.02 etc?

John
0

##### Share on other sites
Hey guys,

Just a note after all my previous side interests, mine compiled fine. I am using Direct x 7 and VC++.

Now I had DirectX 8 SDK before and i always got problems trying to compile direct draw programs that compiled fine on my friends computer who had DX7. I deleted 8 and reinstalled 7 and everything works so long as I link everything properly.

Perhaps you should dig up your old DirectX 7 cd and reinstall it. If it aint broke dont fix it.

MIKED
0

##### Share on other sites
Sturm: my CD-Rom drive is E. The only thing that is running from it is (as far as I know) the include and lib libraries, plus the help files.

Teej: I tried running codebase1.exe on my machine, I got: Initialization ERROR
DD_Init failed: -7, same as polimint.

Polimint: happy to hear I am not alone :-)

Darkpunk: DirectX 7.0 was my first choice, but can''t find it anywhere. Microsoft only has ver 8.0. I am sure that would solve my problem but do you have any ideas where I could download it from?

Anyway, thanks guys for your input, will let you know as soon as I found out anything.
0

##### Share on other sites
ok well i bet im doing something totally wrong but when i tryed to compile gamemain.cpp like it says in the artical i got the stated compiling errors so i checked under tools/options/directories and my directx include dir was already there followed by my project directory so i got the idea to put all the necisary lib h and dll files needed in my proiject directory and add them to my project but that dosent work heh i have no clue what im doign wrong so if anyone could help i would much appreciate it
0

##### Share on other sites
Here is something straight from the mothership - the MS documentation that came with the SDK ver 8.0:

- Visual C/C++ 5 compatibility in DirectX 8.0 depends on Service Pack 3 for Visual Studio 97. If you see the following errors:
"fatal error LNK1106: invalid file or disk full: cannot seek to 0x389bc8bf"
"Internal error during Pass1"
then you need to upgrade your Visual C/C++ 5 installation. Service packs for Visual Studio can be found at http://msdn.microsoft.com/vstudio/sp/vs97/full.asp

Once installed, it did fix the problem.

Edited by - higgenkreuz on May 22, 2001 12:01:25 AM
0

##### Share on other sites
Cheers for that Higgenkreuz, I''m going to try it now...

Lets pray it works!!!

Polomint
0