Jump to content
  • Advertisement

Archived

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

maneesh

Please help with problem

This topic is 6315 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 attempted to compile the program demo8_3.cpp from Tricks of the Windows Game Programming Gurus by André LaMothe, where there are asteroids bumipng around the edges of the screen. Unfortunately, i had a compilation error. I included ddraw.h and ddraw.lib, and I have DirectX8.0. I get the following errors: C:\Program Files\Microsoft Visual Studio\MyProjects\asteroids\demo8_1.cpp(50) : error C2065: ''LPDIRECTDRAWSURFACE4'' : undeclared identifier C:\Program Files\Microsoft Visual Studio\MyProjects\asteroids\demo8_1.cpp(50) : error C2146: syntax error : missing '')'' before identifier ''lpdds'' C:\Program Files\Microsoft Visual Studio\MyProjects\asteroids\demo8_1.cpp(50) : error C2059: syntax error : '')'' C:\Program Files\Microsoft Visual Studio\MyProjects\asteroids\demo8_1.cpp(71) : error C2146: syntax error : missing '';'' before identifier ''lpdd'' C:\Program Files\Microsoft Visual Studio\MyProjects\asteroids\demo8_1.cpp(71) : error C2501: ''LPDIRECTDRAW4'' : missing storage-class or type specifiers C:\Program Files\Microsoft Visual Studio\MyProjects\asteroids\demo8_1.cpp(71) : fatal error C1004: unexpected end of file found How can I fix these? These are straight from the book. I know there should be an LPDIRECTDRAWSURFACE4, but apparently, my compiler doesn''t recognize it. Thanks, Maneesh

Share this post


Link to post
Share on other sites
Advertisement
It sounds like you haven''t linked to the Direct Draw libraries. (I am at school so I don''t have my compiler handy, but I will post back on how to fix it when I get home).

Share this post


Link to post
Share on other sites
No Moe, as I said, I included ddraw.lib as it was required by Mr. Lamothe. That isn''t the problem.

-Maneesh

Share this post


Link to post
Share on other sites
You havent included the *correct* directX headers.
You need to reconfigure your compiler to look in the correct place (where you installed the SDK) otherwise it will just use the default ones, which only go as far as DX3.

If you are using MSVC, go tools->options->directories, select include files from the dropdown box, add a new directory and make sure you shift it to the top of the search order. Do the same for library files or youll get a similar linker error later.

Share this post


Link to post
Share on other sites
I already did that, I have been able to compiile other DIretX progams. In MSVC++, i have it set to C:\Program FIles\Directx\SDK\include and lib. I even tried including every single DirectX library, but it still didn''t work. That isn''t the problem. By the way, it recognizes LPDIRECTDRAW SURACE, but it doesn''t recognize LPDIRECTDRAWSURFACE4


-Maneesh

Share this post


Link to post
Share on other sites
I had similar problems to this in the past but ran out of time so never came up with a solution. However, if I can be a bit constructive I think it is to do with the fact that the demos in the book are all created for directx version 6.1. Now, there is something that needs to be added to the dx6.1 source code to get dx8 to compile it correctly. I think it''s something to do with setting the version but I don''t know the exact details. Possibly somebody can help out here if I''m on the right track.

Hope this helps

henry

Share this post


Link to post
Share on other sites
Thanks a lot KVH, it fixed the problem. But now there are new errors and warnings. NOw there is 3 errors and 55 warnings. The erros are:


D:\Maneesh\GameProgrammingSource\T3dchap12\t3dlib2.cpp(83) : error C2065: ''DirectInputCreate'' : undeclared identifier
D:\Maneesh\GameProgrammingSource\T3dchap12\t3dlib2.cpp(110) : error C2065: ''DIDEVTYPE_JOYSTICK'' : undeclared identifier
d:\maneesh\gameprogrammingsource\t3dchap12\t3dlib3.h(64) : error C2065: ''DSBCAPS_CTRLDEFAULT'' : undeclared identifier

How do I fix these errors. I have included dinput.h and dinput.lib and ddraw.h and ddraw.lib

Share this post


Link to post
Share on other sites
In DX8, they changed a few things. DirectInputCreate became DirectInput8Create, I believe, and DIDEVTYPE_JOYSTICK became DI8DEVTYPE_JOYSTICK, but I''m not entirely sure about these. They also decided to no longer #define DSBCAPS_CTRLDEFAULT. Try this:
#define DSBCAPS_CTRLDEFAULT (DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLPAN)

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!