Jump to content
  • Advertisement
Sign in to follow this  
Ziel

cant use directx in visual studio

This topic is 3702 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

Everytime I try to compile my program that uses DirectX, it wont compile :(. I'm completely new to using DirectX in programming. Someone help me please, thanks in advance!
------ Build started: Project: wndprogtest, Configuration: Debug Win32 ------
Linking...
wndprogtest.obj : error LNK2001: unresolved external symbol _IID_IDirectDraw7
C:\Documents and Settings\Matt\Desktop\wndprogtest\Debug\wndprogtest.exe : fatal error LNK1120: 1 unresolved externals
Build log was saved at "file://c:\Documents and Settings\Matt\Desktop\wndprogtest\wndprogtest\Debug\BuildLog.htm"
wndprogtest - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Share this post


Link to post
Share on other sites
Advertisement
It sounds like you're new to using API's in general ;)

You've got a classic linker error there - after compiling (it did compile successfully if it's up to the linking stage), the linker has to put all the bits of compiled code together, including any API's that you're using.
In this case, the linker is telling you that it can't find the DirectX files that it needs.

Go into the properties of your project, then into the Linker section, and then the "Additional Dependencies" field. Add d3d.lib and d3dx.lib to this field.

Share this post


Link to post
Share on other sites
------ Build started: Project: wndprogtest, Configuration: Debug Win32 ------
Compiling...
wndprogtest.cpp
Linking...
LINK : fatal error LNK1104: cannot open file 'd3d.lib'
Build log was saved at "file://c:\Documents and Settings\Matt\Desktop\wndprogtest\wndprogtest\Debug\BuildLog.htm"
wndprogtest - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Share this post


Link to post
Share on other sites
Ok, looks like your IDE isn't configured to locate the DirectX SDK installation.

This step varies a bit depending on which version of Visual Studio you're using.

1) Go to Tools menu -> Options....

On VS 2005:
2) Select Projects and Solutions -> VC++ Directories.

On VS 2003:
2) Select Projects -> VC++ Directories.

3) Then select "Library Files" from the top-right drop-down box, and add "C:\Program Files\Microsoft DirectX SDK (February 2007)\Lib\x86" to the list (but change the path to what your actual DX SDK install directory is).


[EDIT]Arg! You can probably ignore this post so far.

I gave you the wrong library name before! Sorry, that should be d3d9.lib (or d3d8.lib etc depending on which SDK version you have installed), not d3d.lib.

Share this post


Link to post
Share on other sites
Quote:
Original post by Hodgman
[EDIT]Arg! You can probably ignore this post so far.

I gave you the wrong library name before! Sorry, that should be d3d9.lib (or d3d8.lib etc depending on which SDK version you have installed), not d3d.lib.
Actually, IID_IDirectDraw7 is in dxguid.lib, and you'll probably need ddraw.lib too.


Although, I'd highly recommend against using DirectDraw - it's not hardware accelerated, it's out of date, and it needs a lot of code to get stuff working. I'd recommend going for Direct3D instead.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!