DX7 source example wont work DDEx1

Started by
9 comments, last by Frazzuld 24 years ago
I tried to open and compile this source and I get 3 errors, all with the same line of code: LPDIRECTDRAW7 g_pDD = NULL; // DirectDraw object here are the errors: C:\mssdk\samples\Multimedia\DDraw\src\DDex1\ddex1.cpp(39) : error C2146: syntax error : missing '';'' before identifier ''g_pDD'' C:\mssdk\samples\Multimedia\DDraw\src\DDex1\ddex1.cpp(39) : error C2501: ''LPDIRECTDRAW7'' : missing storage-class or type specifiers C:\mssdk\samples\Multimedia\DDraw\src\DDex1\ddex1.cpp(39) : fatal error C1004: unexpected end of file found now this is source right out of the DX7 SDK... I am using VC++ 6.0, so I dont understand what the heck is going on here... MS cant even write compilable code with their own junk?!
If it ain't broke, I haven't fixed it yet!!
Advertisement
Try including the mssdk folder as an area where header files are stored. Visual C++ thinks that the headers are in the Program Files directory, and is not finding the ddraw.h in it.
Junk? What''s up with people blaming the tools when they make a mistake?

Just check your include paths. You''re obviously getting past the "include < ddraw.h >" line (well, I assume that instruction is there), but LPDIRECTDRAW7 isn''t recognized. The compiler looks for the first "ddraw.h" in the include path, and stops searching. If it finds a header for DX5, DX7 stuff (like LPDIRECTDRAW7) won''t be defined.

Put the DX7 SDK in the include path before the default headers, and I bet all will be well.

Jesse Chounard
stinkygoop@crosswinds.net
How did I make a mistake when it is THEIR source, THEIR headers, THEIR workspace, and THEIR SDK i am using? I didnt alter any of it... this is an example straight out of the SDK... SO GET OFF MY BACK!!! hehe, j/k

I put the SDK directory at the top of the list and it COMPILES fine, but when I go to build it is when I get the errors





Edited by - Frazzuld on 4/5/00 8:31:28 PM
If it ain't broke, I haven't fixed it yet!!
Okay, I did what I was told and here are the errors I am getting now... I have not modified this code in anyway

ddex1.obj : error LNK2001: unresolved external symbol _DirectDrawCreateEx@16
ddex1.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw7
.\Debug/ddex1.exe : fatal error LNK1120: 2 unresolved externals

If it ain't broke, I haven't fixed it yet!!
You also have to include the lib files with the source.

Under project menu, then settings
choose the link tab and then add ddraw.lib and dxguid.lib to all the other lib''s listed there.
Just because the church was wrong doesn't mean Galileo wasn't a heretic.It just means he was a heretic who was right.
FUH... man. You''re a genius Nytegard (and whoever else). I wrote a post about this about 2 hrs ago. I come up here and read yours and there is my solution. Thanks man... you seriously saved my butt. =)

thank you thank you.
-shpook
Okay, I reinstalled EVERYTHING. I checked my paths under Tools/Options and the SDK directory is the first on the list. I checked the Projects/Settings and the ddraw.lib and dxguid.lib were included. It still gives me that second set of errors. Now what?
If it ain't broke, I haven't fixed it yet!!
Okay, I found it... under Tools/Options I wasnt including the LIB path, jsut the Include path... thanks for the help guys
If it ain't broke, I haven't fixed it yet!!
Now do you see that it WAS your mistake and not MS or VC? I''ll admit it is not an obvious mistake, and I believe that Visual C++ install would benifit from NOT installing ANY DirectX SDK by default, so that when you did install a DirectX SDK they would make sure and walk you through the setup procedure.
They go to all this trouble to create userfriendly little WIZARDS, and then they forget that people REALLY need configuration/setup wizards the most. And a guide that would explain the parts of the "hello world" generated code would really help newbies.

Better luck next time.

This topic is closed to new replies.

Advertisement