• 14
• 12
• 9
• 10
• 13

Get Dir. X working?

This topic is 4317 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I dont know much programming, just the most simple commands. Im trying to follow the very first DirectX examples with ddraw.h and ddraw.lib I found in a book called "Windows Game programming for dummies" by André Lamothe. And Im really dumb so... I have taken time to install DirectX Sdk so I expected it to work from the instructions by the book. But I get a bunch of errors at a row that looks like: LPDIRECTDRAW7 lpdd; // pointer to direct draw object error C2146: syntax error : missing ';' before identifier 'lpdd' error C2501: 'LPDIRECTDRAW7' : missing storage-class or type specifiers fatal error C1004: unexpected end of file found I just downloaded and installed a version of DxSDK, and I run Visual C++ 6 on winXP. What does the compiler want from me?

Share on other sites
Quote:
 error C2146: syntax error : missing ';' before identifier 'lpdd'

What happens if you change LPDIRECTDRAW7 to LPDIRECTDRAW ?
Acording to the error the compiler dont recognize LPDIRECTDRAW7.
What version of DX SDK did you install ?

Quote:
 fatal error C1004: unexpected end of file found

Make sure you dont miss any brackets anywhere in the code

Share on other sites
I've already tried "LPDIRECTDRAW" but i get even more errors with undeclared identifiers and warnings. I dont think I have missed any brackets because this is an example from the disc that came with the book.

The version I installed is called Ms DirectX SDK (April 2006), and I just downloaded it from microsoft. It feels like my Visual C++ dosent understand that I have installed Sdk. Ive also noticed that I have to choose what user I should log in to WinXP since I installed SDK, but there is only one user to log in with.

Share on other sites

Make sure you have

#define INITGUID
#include <ddraw.h>

somewhere at the top of the file

Share on other sites
ddraw.h is included

I use msvc++ 6.0.

But microsoft products have a way of never work.

Share on other sites
define INITGUID & include <ddraw.h> is there

Share on other sites
Thats strange indeed.

I wrote this test and it compiled fine:
#define INITGUID#include <ddraw.h>int WINAPI WinMain(HINSTANCE hinst, HINSTANCE hprevinst, LPSTR cmd, int show){	LPDIRECTDRAW7 lpdd;	return 0;}

I opened ddraw.h and searhed for LPDIRECTDRAW7:

...
typedef struct IDirectDraw7 FAR *LPDIRECTDRAW7;
...

Maybe you should check if you find it too

Share on other sites
Quote:
 Original post by slutbitddraw.h is includedI use msvc++ 6.0.But microsoft products have a way of never work.

Are you sure you are correctly linking to the DDraw library files as well?

Share on other sites
"Are you sure you are correctly linking to the DDraw library files as well?"

no, thats where I think the problem is. I was in the menu - settings - Link, and wrote ddraw.lib where theres a bunch of other .lib files. So I thought I had linked it, is there more to do?