Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

xtrmntr

strange DX7 errors

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''m just converting over to DX7 and have run into a problem. i have 3 files: main.cpp, ddtools.cpp, ddtools.h i have set up the .lib files for DX7. ddtools.h: #define SafeRelease(x) if (x) { x->Release; x=NULL } LPDIRECTDRAW7 lpdd=NULL; LPDIRECTDRAWSURFACE primary=NULL, secondary=NULL; LPDIRECTDRAWCLIPPER clipper=NULL; BOOL DDInit(); void DDRelease(); In main.cpp: #define WIN32_LEAN_AND_MEAN #include #include #include "ddtools.h" ... When i try to build it these are the errors i get: error C2146: syntax error : missing '';'' before identifier ''lpdd'' c:\my documents\d7\ddtools.h(8) : error C2501: ''LPDIRECTDRAW7'' : missing storage-class or type specifiers c:\my documents\d7\ddtools.h(8) : fatal error C1004: unexpected end of file found why am i getting these? In a previous program i did the same thing but it works!? help would be appreciated

Share this post


Link to post
Share on other sites
Advertisement
I''m not sure if this is the issue but I had a similar problem with DX7..when you add the path for the libraries and header files you have to move it to the top of the list, otherwise VC++ will stop at the first one it finds, which may be an older version..even though I had setup the proper paths, I didn''t know that I had to give them top priority, and I got the same error messages that you said you had..hope it helps, if not, enjoy your continuing nightmare


"Like all good things, it starts with a monkey.."

Share this post


Link to post
Share on other sites
erm.....

you wrote:
#define SafeRelease(x) if (x) { x->Release; x=NULL }

you dont have a semi-colon at the end of x=NULL, like

#define SafeRelease(x) if (x) { x->Release; x=NULL; }

also, the LPDIRECTDRAW7 interface, and all like it (ie, LPDIRECTDRAWSURFACE7) dont exist untill you include. You need to include ddraw.h first

Edited by - Magicdude on September 1, 2000 8:08:26 PM

Share this post


Link to post
Share on other sites
First of all the semi-colon IS there i must have missed typing it in my post. Secondly i do have the includes/libs moved to the top of the directories listing. Lastly shouldnt the fact that i include ddraw.h before i include ddtools.h already include the direct draw files? i have seen this done in other programs such as LaMothes for dummies book as well as SAMS DX7 in 24 hours (yeah right). However i DID take your advice and include it but now i get this slew of errors:

main.obj : error LNK2005: "struct IDirectDrawClipper * lpddclipper" (?lpddclipper@@3PAUIDirectDrawClipper@@A) already defined in ddtools.obj
main.obj : error LNK2005: "struct IDirectDrawSurface7 * lpddsback" (?lpddsback@@3PAUIDirectDrawSurface7@@A) already defined in ddtools.obj
main.obj : error LNK2005: "struct IDirectDrawSurface7 * lpddsprimary" (?lpddsprimary@@3PAUIDirectDrawSurface7@@A) already defined in ddtools.obj
main.obj : error LNK2005: "struct IDirectDraw7 * lpdd" (?lpdd@@3PAUIDirectDraw7@@A) already defined in ddtools.obj
Debug/d7.exe : fatal error LNK1169: one or more multiply defined symbols found

i dont define them anywhere else cept for ddtools.h. so anymore thoughts?

Share this post


Link to post
Share on other sites
First, make sure for both includes and libraries, your latest DirectX directories are listed first in the order of linking (Tools->Options->Directories for VC). Then you should Rebuild All.

Share this post


Link to post
Share on other sites
Quick reply : you are initalising variables in a header, move them to the .cpp file

Long reply:

Move the following lines to the .cpp file

LPDIRECTDRAW7 lpdd=NULL;
LPDIRECTDRAWSURFACE primary=NULL, secondary=NULL;
LPDIRECTDRAWCLIPPER clipper=NULL;

and add these to the header file:

extern LPDIRECTDRAW7 lpdd;
extern LPDIRECTDRAWSURFACE primary, secondary;
extern LPDIRECTDRAWCLIPPER clipper;

That will fix the problems you are having with the ''this object is already created in this .obj file'' errors.

Share this post


Link to post
Share on other sites
Thanks Steven, I found this out last night, however, something even more strange is that if i take away the NULL declarations in the header it still gives me crap. Guess i shouldnt fight the compiler/linker they know best right?

Share this post


Link to post
Share on other sites
I also am having problems after moving to DirectX7. Or so I thought

I also swiched to VC++ IDE too (I was using Borland''s 32bit command line compiler before). Hey, its free and works GREAT!

Anyway... about your problem. I believe it is that DirectX1.0 is included with your compiler. Which means that when you include ddraw.h in your app, it finds ddraw.h (version 1.0). You may be thinking "No! I set my path to DirectX7 ddraw.h!". But remember that the default include directory set for you compiler is *probably* before your DirectX7.0 include... which means... it finds ddraw.h (1.0) before (7.0) and includes it.

I suggest moving your DirectX7.0 include before all the others so that it finds the right ddraw.h header file.

I have yet to try this, but I think thats what the problem is!

The reason why i think this is that when I declare:

LPDIRECTDRAW lpDD; // works
LPDIRECTDRAW7 lpDD7; // doesn''t work!
LPDIRECTDRAW4 lpDD4; // still doesn''t work!

Since I was using Borland''s before, it didn''t come with ddraw.h (1.0) so it automatically used the one I specified (6.0) and worked (was using DirectX6 at that time and using LPDIRECTDRAW4.).

Hope this helps!
Later,
Kaewan

Share this post


Link to post
Share on other sites
i get a simular error with the 7a sdk but it doesnt happen on a debug build

--------------------Configuration: complex - Win32 Release--------------------
Linking...
complex.obj : error LNK2001: unresolved external symbol _GUID_SysMouse
complex.obj : error LNK2001: unresolved external symbol __imp__timeGetTime@0
dinput.lib(dilib1.obj) : error LNK2001: unresolved external symbol _GUID_ZAxis
dinput.lib(dilib1.obj) : error LNK2001: unresolved external symbol _GUID_YAxis
dinput.lib(dilib1.obj) : error LNK2001: unresolved external symbol _GUID_XAxis
Release/complex.exe : fatal error LNK1120: 5 unresolved externals
Error executing link.exe.

complex.exe - 6 error(s), 0 warning(s)


Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!