Sign in to follow this  
slutbit

Get Dir. X working?

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 this post


Link to post
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 this post


Link to post
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 this post


Link to post
Share on other sites
Without more info I have to guess...

Make sure you have

#define INITGUID
#include <ddraw.h>

somewhere at the top of the file

Share this post


Link to post
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 this post


Link to post
Share on other sites
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?

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites
That is almost certainly a compile-time error, not a linker error, but if Visual C++ can't find the header file, it would say so first. Very strange. If no-one else suggests anything more sensible, I'd try reinstalling everything at this point. Sorry that is not very helpfull.

Share this post


Link to post
Share on other sites
Check in your directory settings, the include directory for the SDK must be topmost.

AFAIK an older version of ddraw may be included in your Visual Studio which doesn't have DirectDraw7 yet.

Share this post


Link to post
Share on other sites
I think it has DD7, rumors say that winXp has DX8 or 9 installed from the start.

I just noticed that it doesent want to include the files that is under the directory c:\...\Microsoft DirectX SDK (April 2006)\Include. Can i tell vc++ to not ignore this folder, or should i move all the .h files to c:\...\VC98\Include. Then its problably the samt thing with the lib directory. Am i wrong?

Share this post


Link to post
Share on other sites
Hmm, i think the later DirectX SDKs will not properly install with VS6 anymore. You can probably get older stuff working (like DirectDraw), but with D3DX you'll get into trouble.

As it will not install properly you'll have to do the registration with Visual Studio yourselves. There should be a option called "Customize" somewhere (Menu "Tools" or "Extras"). In there you should find a tab with a list of directories for different kinds. One of these should be include files. There you have to add a new item on top with the include path to your "c:\...\Microsoft DirectX SDK (April 2006)\Include". You should do the same with the lib folder under the "library path" item. This allows VS to look into that include folder and also find the lib files.

The names of the items will differ as i don't have access to VS6.

Share this post


Link to post
Share on other sites
Quote:

AFAIK an older version of ddraw may be included in your Visual Studio which doesn't have DirectDraw7 yet.


I was thinking about this too.

You could search for multiple ddraw.h files on your system.
Also search for LPDIRECTDRAW7 in your ddraw.h file.

If everything looks ok, I would have to suggest either installing an older version of DirectX SDK, or install MSVC++ 2005 express and Microsoft Platform SDK.

Share this post


Link to post
Share on other sites
Quote:
Original post by slutbit
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.

For starters, it's not a good book. It never was. Further, it refers to a dated version of DirectX, and it makes numerous assumptions as to the reader being in a contemporary era - making the book harder to read now. For instance:
Quote:
Different post by slutbit
I think it has DD7, rumors say that winXp has DX8 or 9 installed from the start.

Windows XP has DirectX 8 runtimes pre-installed, not the Software Development Kit (SDK). You have to download the SDK yourself, regardless of version, and it's so much easier to find and download the DX9 SDK now.

My recommendations:
  1. Download and install Microsoft Visual C++ 2005 Express Edition. It's free, and it's monumentally better than Visual C++ 6.0.

  2. Download and install the Microsoft Windows Platform SDK. It's necessary to develop Win32 applications using MSVC++ 2K5 EE.

  3. Download and install the Microsoft DirectX 9.0 April 2006 SDK. It includes documentation and tutorials to get you up to speed on the basics.

  4. Finally, return here for help with any step, and for tips on where to go after you've got everything running.

Share this post


Link to post
Share on other sites
Quote:
Original post by Endurion
Hmm, i think the later DirectX SDKs will not properly install with VS6 anymore.


Correct. VS6 is now completely unsupported by the DirectX team; while you might get DirectDraw working with it, there are no guarantees, and attempting to bludgeon it into submission may lead to more subtle and insidious bugs.

Get 2005 Express instead. It's free, fully supported, and IMHO a lot better.

Share this post


Link to post
Share on other sites
I still use VS6 and DX7 and on occasion I have to reinstal everything. They work, but you have to mess around with setting directories and link your project to the lib files properly. My recomendations are to make sure the folder you installed the SDK to have relatively simple names (no brackets or spaces if possible) and to include the drive and path to the libraries in your linker settings. In short, don't trust long filename support and go back to the ol' 8.3 names (at least for the folder names).

If possible it'd be best if you can use the latest tools and libraries. The learning curve is about the same if you have a good book and once you're through a few tutorials your more up to speed with the rest of the world. The stuff I write only uses dx7 and I feel as though I'm way behind everybody else. (If dx7 could do alpha blending i might defend using it more, but it doesn't.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this