   Compiler Question
  I wasn't sure where to put this question, so I stuck it in beginner's cuz it's my first post.I'm trying to learn how to program DirectX with Andre Lamothe's "Tricks of the Windows Game Programming Gurus" book, but I've run into some problems with my compiler (I'm using Microsoft Visual C++ 5).I added the necessary directx files to the project (ddraw.lib and ddraw.h), included ddraw.h in the code, and added the directories they're contained in into the search directories for the compiler.Nonetheless, I still get a bunch of weird errors:error C2501: 'LPDIRECTDRAW7' : missing decl-specifierserror C2239: unexpected token 'identifier' following declaration of 'LPDIRECTDRAW7'error C2061: syntax error : identifier 'lpdd7'This is just the first few errors I get. I'll post the source code as soon as I figure out how to attach files.   
  Ok, I'm not sure how to attach my code, so I'll just post it in://Includes ////////////////////////#define WIN32_LEAN_AND_MEAN#include <windows.h>#include <windowsx.h>#include <ddraw.h>//Defines////////////////////////#define WINDOW_CLASS_NAME "GameShell"#define SCREEN_WIDTH 1024 //size of screen#define SCREEN_HEIGHT 768#define SCREEN_BPP 8#define MAX_COLORS 256//Function Declarations//int GameShutdown(void * parms = NULL, int numParms =0);int GameInit(void *parms = NULL, int numParms =0);int GameMain(void *parms = NULL, int numParms =0);//Macros/////////////////////////////////////////////#define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)#define KEYUP (vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0: 1)//GLOBALS///////////////////////////////HINSTANCE hInstanceApp;HWND mainWindowHandle;LPDIRECTDRAW7 lpdd7; //version 7.0LPDIRECTdRAWPALETTE lpdd7pal = NULL; //palette interfaceI'm only gonna post this first part as it relates to the errors that I posted and most of the other errors seem to be similar or stemming from this one.   ;  I program in only directx 9, but isn't it LPDIRECT7DRAW?!? I have never used directdraw, though.Hope this works[smile],exorcist_bobPS you use [ source ] [ /source ] tags without the spaces :)   ;Quote:Original post by Clovermite24I wasn't sure where to put this question, so I stuck it in beginner's cuz it's my first post.I'm trying to learn how to program DirectX with Andre Lamothe's "Tricks of the Windows Game Programming Gurus" book, but I've run into some problems with my compiler (I'm using Microsoft Visual C++ 5).I added the necessary directx files to the project (ddraw.lib and ddraw.h), included ddraw.h in the code, and added the directories they're contained in into the search directories for the compiler.Nonetheless, I still get a bunch of weird errors:error C2501: 'LPDIRECTDRAW7' : missing decl-specifierserror C2239: unexpected token 'identifier' following declaration of 'LPDIRECTDRAW7'error C2061: syntax error : identifier 'lpdd7'This is just the first few errors I get. I'll post the source code as soon as I figure out how to attach files.Hello.1)  I'm sorry, but you don't post files.  However, you can show code in between the [ source] and [ /source] tags (without the spaces, ;)).2)  Post only code that might be useful, don't go posting 100+ lines that may have nothing to do with your problem.3)  My hypothesis is that you have some struct or class that's missing a ';' on the end:class Foo { /* ... */ }; // Don't forget that semilcolon!(Notice how nicely the code is formatted.)4)  May I just ask why you are using VS 5?  I thought at first you said 6, which was going to make me feel woozy...  And you said 5.Anyways, not to be rude, but is there ANY reason why you are using 5?  You can download VS 8 Express (the same as VS 8, but with less really fancy tools) for free here: http://msdn.microsoft.com/vstudio/express/visualc/download/.If you don't wan't to download that HUGE thing (not the installer, the thing the installer downloads ;)) you can try something free, such as http://www.codeblocks.org/ (Code::Blocks) which is very lightweight.However, the VS 8 Express debugger and IDE really pay off the download and install time.6)  Welcome to this website and good luck in the future!C++   ;  I'm pretty sure you haven't added the ddraw.lib to your project settings.  I think in VC5 if you click Project (from the menu) then project settings, then go over to the link tab, and put ddraw.lib into that list of .lib files, it should work.And, no, it's not LPDIRECT7DRAW, your code is correct (LPDIRECTDRAW7).  And please, upgrade to Visual C++.NET 2005 Express Edition, it's a life saver.   ;Quote:Original post by Anonymous Poster May I just ask why you are using VS 5?  I'm using 5 because I left my copy of 6 at school (I'm on break from college).The reason I didn't just download the free version of .net is because I know it has an entirely different UI from 6.I don't want to spend money on a book about how to use .net and there are no books about it in my local library. I have a couple weeks before I head back to school and I want to finish at least learning the basics of directx, if not make a Tetris game like I originally planned, before I head back.I do plan on upgrading eventually, but I don't want to try to learn two different things at the same time.;Quote:Original post by Modena_auI'm pretty sure you haven't added the ddraw.lib to your project settings.  I think in VC5 if you click Project (from the menu) then project settings, then go over to the link tab, and put ddraw.lib into that list of .lib files, it should work.Thank you so much. That was definitely part of the problem, but for some reason I'm still getting the same errors.Any other ideas why it's not still working?If not, would it be easier to learn how to link directx if I just upgrade to .net?One of the reasons I haven't upgraded is that I'm afraid I'll run into exactly the same confusion if I do, combined with the confusion of learning a new compiler.;  SO after you added the ddraw.lib you still had the same problems? If there is any change at all in the compiler output, please post it.  I think you would actually be better off with VC8 as most here are using.  There are very few people here that have ever used VC5, let alone remember it ;).  Since VC8 was released for free, most people have upgraded, so most of the hurdles are well documented here.  If you upgrade and have any more problems, we are more likely to be of assistance.   ;  try including dxguid.lib   ;Quote:Original post by Modena_auSO after you added the ddraw.lib you still had the same problems? If there is any change at all in the compiler output, please post it.Unfortunately no, there was no change in compiler output.Quote:I think you would actually be better off with VC8 as most here are using.Ok thanks, I'll try upgrading. Off the top of your head, do you know of any links to good tutorials on the difference between V6 and .net? or at the very least general tutorials? I looked around the site here a bit but didn't see any.Thanks again!   