Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

cant use directx in visual studio


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
4 replies to this topic

#1 Ziel   Members   -  Reputation: 124

Like
0Likes
Like

Posted 29 June 2008 - 07:01 PM

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 ==========


Sponsor:

#2 Hodgman   Moderators   -  Reputation: 13610

Like
0Likes
Like

Posted 29 June 2008 - 07:48 PM

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.

#3 Ziel   Members   -  Reputation: 124

Like
0Likes
Like

Posted 29 June 2008 - 08:02 PM

------ 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 ==========

#4 Hodgman   Moderators   -  Reputation: 13610

Like
0Likes
Like

Posted 29 June 2008 - 08:20 PM

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.

#5 Evil Steve   Moderators   -  Reputation: 1918

Like
0Likes
Like

Posted 29 June 2008 - 10:40 PM

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.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS