Advertisement

[major newbie question] Visual C++ 6 and DirectX

Started by March 11, 2000 11:11 AM
4 comments, last by Fong Kaozu 24 years, 6 months ago
So I read through all the posts, checked the faq, got my can of flame repelent and I''m ready to ask my pitiful question. I''m not a windows programmer, but I''m trying to learn through LaMothes "Windows Gurus" book. I can''t even compile the first example! I get an error on the very first line that refers to directx, here''s the error: blackbox.cpp c:\dev\t3d source code\t3dchap01\blackbox.h(34) : error C2146: syntax error : missing '';'' before identifier ''lpdd'' c:\dev\t3d source code\t3dchap01\blackbox.h(34) : fatal error C1004: unexpected end of file found and here''s the line of code: extern LPDIRECTDRAW4 lpdd; // dd object The funny thing is, I get this error on _all_ directx stuff I try to compile, from the book and examples from the directx sdk. Always on the first line that mentions directx. I''ve created new projects and added source files, I''ve opened precreated workspaces, I''ve reinstalled Visual C, then I reinstalled the directx sdk, I''ve made sure all my includes and lib directories are on the windows path and included in the project.. always the same errors. Ugh. I know I''m doing something really lame, but I can''t figure out what. If anyone knows the asnwer I would really appreciate the knowledge.. thanks!
I''m also a newbie, so my post probably won''t be much help. However, I think you need to get a DirectX SDK (software development kit). You can download them from teh resources section of Gamedev.

- Hobobo
Advertisement
I have that book. I have the full directX 7.0 SDK. I linked it to the project but it gave me the same error ou are talking about. I am not a rookie compiler user and I know I have everything set up correctly, ie. everything was linked correctly.
My HomepageSome shoot to kill, others shoot to mame. I say clear the chamber and let the lord decide. - Reno 911
Are you linking in the ddraw libs ??? You need to link them and not just set the path to their directory. Also are you using 32 bit window application?? Also in VC++ just because you open a file doesn''t mean its includes in your project, add the headers and .cpp files to your project if you havn''t already.

ECKILLER
ECKILLER
Yay! I'm dumb!

I figured it out finally.. Ugh. If you click on the menu, "Tools" and go down to "Options" you'll get the options window. Click the "Directories" tab, and on the last line under all the other directories, double click. This will give you a field to manually type in the absolute path to your directx lib and include directories. Mine are "c:\MSSDK\INCLUDE" and "c:\MSSDK\LIB". After you've typed both of these in (or used the browse button to browse for them) then drag these directories to the top of the list. This is to supercede the directx components that may be in the lib and include directories of your Visual C++ install.

Then go and build it! Yahoo! Finally!

Oops, one last thing I just noticed, but it didn't seem to matter for the thing I just compiled; When you're in the options window, there's a pull down menu that lets you pick what kind of directories you're including, dirs for includes, or dirs for libs, etc. Choose the right one before adding the directory.

Edited by - Fong Kaozu on 3/11/00 12:17:34 PM
You most likely need to link in the directx libraries.
I use VC6 and for me I would go to
project -> settings -> link
in the box object libraries you add the library files you need. just go to the end of the list and add
ddraw.lib dxguid.lib
I also add winmm.lib
if you are using any other directx things like sound or 3d you need to add those libraries also.

This topic is closed to new replies.

Advertisement