DirectX question
Ive been using LaMothe''s "Tricks" book to learn how to use DirectX. When I try to compile my own program or his using his setup I get a few errors I can''t resolve.
here are my includes
#include
#include
#include
#include
#include
#include
#include // I also included ddraw.lib to my project
manually according to the book
the errors occur in this section of code
LPDIRECTDRAW lpdd = NULL; // dd object
LPDIRECTDRAW4 lpdd4 = NULL; // dd4 object
// errors in line above
LPDIRECTDRAWSURFACE4 lpddsprimary = NULL; // dd primary surfac
LPDIRECTDRAWSURFACE4 lpddsback = NULL; // dd back surface
LPDIRECTDRAWPALETTE lpddpal = NULL; // a pointer to
LPDIRECTDRAWCLIPPER lpddclipper = NULL; // dd clipper
PALETTEENTRY palette[256]; // color palette
PALETTEENTRY save_palette[256]; // used to save
DDSURFACEDESC2 ddsd; // a direct draw DDBLTFX ddbltfx; // used to fill
DDSCAPS2 ddscaps; // a direct draw HRESULT ddrval; // result back from DWORD start_clock_count = 0; // used for timing
errors:
D:\prog\source.cpp(55) : error C2146: syntax error : missing '';'' before identifier ''lpdd4''
D:\prog\source.cpp(55) : error C2501: ''LPDIRECTDRAW4'' : missing storage-class or type specifiers
D:\prog\source.cpp(55) : fatal error C1004: unexpected end of file found
I have no clue to get rid of the errors, could it have anything to do with my having DirectX 7.0a on my computer and the book
using DX 6? I dont know, but any help would be greatly appreciated. Thanks
It seems like this question comes up quite often. I think you need to make sure you have done the following things:
1] Make sure to physically include the DirectX .lib files you are using in your workspace.
2] Make sure you have your include/library directory set up right. They should be pointing to where ever you put the DirectX SDK. I believe you need to make them the first path in the list. (Above any of the other the default C++ paths)
Hope that helps,
-> Briar LoDeran <-
1] Make sure to physically include the DirectX .lib files you are using in your workspace.
2] Make sure you have your include/library directory set up right. They should be pointing to where ever you put the DirectX SDK. I believe you need to make them the first path in the list. (Above any of the other the default C++ paths)
Hope that helps,
-> Briar LoDeran <-
You have to copy all the include files from the DirectX directory
( most of the time c:\mssdk\include ) to the include directory located in your compiler.
also copy the *.lib files from c:\mssdk\lib to the lib directory.
*Take a look at the DirectX SDK help to learn the differences among DirectX 6.x and 7.x.
( most of the time c:\mssdk\include ) to the include directory located in your compiler.
also copy the *.lib files from c:\mssdk\lib to the lib directory.
*Take a look at the DirectX SDK help to learn the differences among DirectX 6.x and 7.x.
If you''re using MS''s DevStudio you can ''point'' to where you installed your DX include''s and libraries so that it will look there for the files. Then once you do that make sure to include the libraries in project->settings->link(tab). The directories tab is in the options menu.
~S''Greth
Got Code?
~S''Greth
Got Code?
Also, if you are using Visual C++ 6, and you used the Wizard to start a new Win32 project, you have to place the following line at the top of every C++ source file:
#include "stdafx.h"
That may be what''s causing the errors you''re getting ... maybe not.
#include "stdafx.h"
That may be what''s causing the errors you''re getting ... maybe not.
What''s happening here, is that his compiler has the old version of DirectX in his include directory. If he''d be writing an API using DirectDraw; there would be no problem at all, but he''s trying to use a newer version of DirectX and the compiler is not aware that DirectX has been updated.
So what you have to do is get your compiler to use the new code that comes with the SDK.
and that new code is in c:\mssdk
also don''t forget to link ddraw.lib and dxguid.lib from the new version.
and if you have DirectX 7 installed, then use DirectX 7.
and don''t inlcude "stdafx.h" cause this is only for MFC. sure unless you''re working with MFC.
So what you have to do is get your compiler to use the new code that comes with the SDK.
and that new code is in c:\mssdk
also don''t forget to link ddraw.lib and dxguid.lib from the new version.
and if you have DirectX 7 installed, then use DirectX 7.
and don''t inlcude "stdafx.h" cause this is only for MFC. sure unless you''re working with MFC.
Well, I''ve never included dxguids.lib I use
#define INITGUID
and all is fine
Actually I have no idea what INITGUID does, maybe it links dxguids.lib?
All I know is when i start something new i always forget it and sit around pondering over the guid errors i get
Martin Björklund
#define INITGUID
and all is fine
Actually I have no idea what INITGUID does, maybe it links dxguids.lib?
All I know is when i start something new i always forget it and sit around pondering over the guid errors i get
Martin Björklund
Just to clarify something a little, "stdafx.h" is not just for MFC, you need to include it whenever you are using precompiled headers.
Well actually, you could name the precompiled header file anything, but "stdafx.h" is the name given to it by the Win32 Application Wizard in VC 6.
Well actually, you could name the precompiled header file anything, but "stdafx.h" is the name given to it by the Win32 Application Wizard in VC 6.
#define''ing INITGUID before including the dx headers accomplishes the same thing as linking to dxguid.lib (though it doesn''t link).
INITGUID makes the DEFINEGUID macro actually initialize the guids it declares, instead of simply declaring them as external data.
INITGUID makes the DEFINEGUID macro actually initialize the guids it declares, instead of simply declaring them as external data.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement