Get Dir. X working?

Started by
17 comments, last by slutbit 17 years, 10 months ago
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?
Advertisement
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
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.
Without more info I have to guess...

Make sure you have

#define INITGUID
#include <ddraw.h>

somewhere at the top of the file
ddraw.h is included

I use msvc++ 6.0.

But microsoft products have a way of never work.
define INITGUID & include <ddraw.h> is there
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
Quote:Original post by slutbit
ddraw.h is included

I 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?
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
"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?
I tried them rows pulpfist. I got the exact same errors as last time.

This topic is closed to new replies.

Advertisement