Archived

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

How do I get DXsdk 8.1 to work with C++?

This topic is 5597 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''ve installed DirectX SDK 8.1 on my harddrive but how do I get it to work with Visual C++ 5.0? I added include and lib directories within the options of DevStudio but I get some very weird problems trying to compile a program that game with a book I bought... "Tricks of the Windows Game Programming GURUS Second Edition" - Published by Sams. Errors: Compiling... WinMain.cpp C:\Program Files\DevStudio\MyProjects\Astroids\WinMain.cpp(134) : warning C4101: ''buffer'' : unreferenced local variable C:\Program Files\DevStudio\MyProjects\Astroids\WinMain.cpp(286) : warning C4101: ''hdc'' : unreferenced local variable Linking... WinMain.obj : error LNK2001: unresolved external symbol _DirectDrawCreateEx@16 Debug/Astroids.exe : fatal error LNK1120: 1 unresolved externals Error executing link.exe. Did I install DirectX SDK 8.1 wrong? John DiSanti of Santi Productions.

Share this post


Link to post
Share on other sites
It''s not enough to add the path to the include and lib ... you have to add this :

Menu Project/Settings
Tab Link
-> object/library modules

add this library : ddraw.lib

or else easier write this line in your main cpp file :

#pragma comment(lib,"ddraw.lib")


__________________________



Bruno Wieckowski
Lead Programmer
Exood4 Studios

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Mulligan
put:
#pragma comment(lib, "ddraw.lib"
at the top of the program


Pragmaing in a lib file is just horrible coding practice. Learn how to use your compiler eesh!

Share this post


Link to post
Share on other sites
I have tried putting the ddraw.lib in the linkers settings but now I have 1 new error and the other errors are gone ! But this error says:

Compiling...
WinMain.cpp
C:\Program Files\DevStudio\MyProjects\Astroids\WinMain.cpp(135) : warning C4101: ''buffer'' : unreferenced local variable
C:\Program Files\DevStudio\MyProjects\Astroids\WinMain.cpp(287) : warning C4101: ''hdc'' : unreferenced local variable
Linking...
C:\DXSDK\LIB\ddraw.lib : fatal error LNK1106: invalid file or disk full: cannot seek to 0x3b160894
Error executing link.exe.

I have 32 Gigabytes of harddrive space and the file does exist. I even made sure of it. Is there a possible way of fixing this?


John DiSanti of Santi Productions.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Have you tried putting the include/lib paths at the top of the directory list. By Default VC looks for the includes & libs from the top down, so it could be referencing an older version of DX that shipped with VC++5.

Cheers
Dazzer

Share this post


Link to post
Share on other sites
From MSDN:

quote:

Linker Tools Error LNK1106
invalid file or disk full: cannot seek to location

The tool could not read or write to location in a memory-mapped file.

Tips

Your disk may be too full to complete the link. Free up some space and try the link again.


The error may be a result of trying to link over a network. Some networks do not fully support the memory-mapped files used by the linker. Try linking on your local disk to see if that fixes the problem.


There may be a bad block on your disk. Although the operating system and disk hardware should have detected such an error, you may want to run a disk checking program.



Which OS are you using, and have you checked your disk for errors? Is this the only program that gives you this error, or do all programs you compile give the same error? It may just be that the library is corrupt, or looking at the MSVC ddraw.lib library instead of your DX installation directory. As mentioned, make sure your DirectX installation directory is at the top of the list (under tools, options, directories):








Jim Adams
home.att.net/~rpgbook
Author, Programming Role-Playing Games with DirectX

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Take the lib files out of the SDK lib directory and paste them over the lib files in the lib directory of the compiler/linker.

Click on project in the menu bar
click on Project Settings
Click on the link tab
on the line that says modules/libraries
type in:
ddraw.lib dxguid.lib

Share this post


Link to post
Share on other sites
I finally got my greedy little hands on VC++ 6.0 Introductory Edition, put in all the settings and hit the build button... It works!!!!! Error free! Warning free!!! Who ever said that the new SDK wasn''t compatible with VC++ 5 was correct! Thanks for all the info!


John DiSanti of Santi Productions.

Share this post


Link to post
Share on other sites