Visual C++ and DirectX , beginner help needed

Started by
7 comments, last by GameDev.net 19 years, 9 months ago
I am trying (Emphasize trying) to get DirectX to work with microsoft''s Visual C++. However, even basic tutorials get errors and do not work. So far I have downloaded DX SDK 9.0, and have included in the Visual C++ Tools->>Options->>Directories, for include directorys: C:\ dx sdk\include, and for the library directorys: C:\dx sdk\lib I am not sure if this is the problem or not, but it also gives this error when I try to compile it: Output Window Compiling... WinMain.cpp c:\c++ programs\tut\cdirectdrawgame.h(40) : error C2146: syntax error : missing '';'' before identifier ''m_lpdd7'' c:\c++ programs\tut\cdirectdrawgame.h(40) : error C2501: ''LPDIRECTDRAW7'' : missing storage-class or type specifiers c:\c++ programs\tut\cdirectdrawgame.h(40) : error C2501: ''m_lpdd7'' : missing storage-class or type specifiers c:\c++ programs\tut\cdirectdrawgame.h(41) : error C2146: syntax error : missing '';'' before identifier ''m_lpdds_primary'' c:\c++ programs\tut\cdirectdrawgame.h(41) : error C2501: ''LPDIRECTDRAWSURFACE7'' : missing storage-class or type specifiers c:\c++ programs\tut\cdirectdrawgame.h(41) : error C2501: ''m_lpdds_primary'' : missing storage-class or type specifiers c:\c++ programs\tut\cdirectdrawgame.h(42) : error C2146: syntax error : missing '';'' before identifier ''m_lpdds_back'' c:\c++ programs\tut\cdirectdrawgame.h(42) : error C2501: ''LPDIRECTDRAWSURFACE7'' : missing storage-class or type specifiers c:\c++ programs\tut\cdirectdrawgame.h(42) : error C2501: ''m_lpdds_back'' : missing storage-class or type specifiers c:\c++ programs\tut\cdirectdrawgame.h(45) : error C2146: syntax error : missing '';'' before identifier ''m_lpdi8'' c:\c++ programs\tut\cdirectdrawgame.h(45) : error C2501: ''LPDIRECTINPUT8'' : missing storage-class or type specifiers c:\c++ programs\tut\cdirectdrawgame.h(45) : error C2501: ''m_lpdi8'' : missing storage-class or type specifiers c:\c++ programs\tut\cdirectdrawgame.h(46) : error C2146: syntax error : missing '';'' before identifier ''m_di_keyboard'' c:\c++ programs\tut\cdirectdrawgame.h(46) : error C2501: ''LPDIRECTINPUTDEVICE8'' : missing storage-class or type specifiers c:\c++ programs\tut\cdirectdrawgame.h(46) : error C2501: ''m_di_keyboard'' : missing storage-class or type specifiers
Advertisement
When you added the directories for the includes and libraries, did you add them at the top of their lists, before any other directories? This is very important, otherwise the compiler will pick up earlier versions of the directx headers that shipped with visual studio.

Alan
"There will come a time when you believe everything is finished. That will be the beginning." -Louis L'Amour
No, I hadn''t. But doing it didn''t change anything though. Thanks for the suggestion though.
Ok, I think I have an idea where I am going wrong now.

http://www.cplusplus.com/src/ and then scroll down and click on the Basic Direct 3D. Download it, and then extract it. That''s what I did, then I assumed to make it work you would just double click on the "WinMain.cpp", and then build it like that?
you also need to add the libs you're using to the linker's command line.

if you're using...

... VC++ 6 go to project\settings\Link and add dxguid.lib d3d9.lib ddraw.lib dinput8.lib and whatever else you might be using to Object/library modules.

... VC++ .NET go to project\properties\Linker\Command Line and add the same as above in the additional options.

and finally, you got some syntax errors. dont forget the ;

hope this helps
VRAM Strider.

[edited by - VStrider on June 6, 2004 11:17:50 PM]
___________________________________________________VRAM_Strider."This is the same damn ship that blows panels everytime it is shot, gets stolen on numerous occasions, has next to no security on any of its computer systems, allows almost anyone into the heart of the ship, and places the bridge and all the exec offices on the top of the ship?That enterprise?"
Set Directory Enviroment to DirectX SDK, so that if it still error you must change LPDIRECTDRAW7 to LPDIRECTDRAW and etc...

Set Directory Enviroment to DirectX SDK, so that if it still error you must change LPDIRECTDRAW7 to LPDIRECTDRAW and etc...

Thanks for the help guys, but I figured out what I was doing wrong. When I opened the tutorial I was clicking on the source code instead of the "Project", which kinda screwed everything up. Thanks for your help though
Is it possible to download Direct 3D, or does it only come with video cards/computer add-ons?
(I need it to play the FF7 demo on my comp...)

This topic is closed to new replies.

Advertisement