Setting up DirectX on Visual Studio.net

Started by
10 comments, last by GameDev.net 17 years, 2 months ago
http://www.microsoft.com/downloads/details.aspx?FamilyID=09f7578c-24aa-4e0a-bf91-5fec24c8c7bf&DisplayLang=en#issues
Quote:If you encounter compilation issues related to the DirectX headers, make sure that the include directories in Visual Studio are set correctly. On the Win32 platform, make sure that there is a reference to the DirectX headers. Either "$(DXSDK_DIR)include" or "c:\program files\microsoft DirectX SDK (February 2007)\Include" should appear in the include directory "$(VCInstallDir)Include."
I'm trying to set up DirectX for a program. I know that you have to go to tools -> options -> VC++ Directories -> Include Files But I'm not sure what I should be adding... this?: $(DXSDK_DIR)include - All the other files look something like this but what does it have to do with the last bit... " should appear in the include directory $(VCInstallDir)Include." Here's the list of include files that were already there: $(VCInstallDir)include $(VCInstallDir)atlmfc\include $(VCInstallDir)PlatformSDK\include $(FrameworkSDKDir)include Also, someone said that for this code to compile I need to add directx to the library files in the "SDK\Lib\x86" which looks like this: $(VCInstallDir)lib $(VCInstallDir)atlmfc\lib $(VCInstallDir)atlmfc\lib\i386 $(VCInstallDir)PlatformSDK\lib $(FrameworkSDKDir)lib $(VSInstallDir) $(VSInstallDir)lib Would really appreciate some help. I like programming but I really hate using Visual Studio.net. I never get why things don't compile there!
Advertisement
hi,
if you have installed the directX 9 SDK this operation is done for you, you have nothing to do. However if (i don't know why) the include files and lib files haven't been added in the list which you show above, you have to do that :
-install the directX SDK and go in the list you show above, there you can add a directory and specify the path of the include's files (the ones from the directX sdk)
-do the same for the library files and indicate the path of the "lib" directory of the SDK.

tell me if you have difficulties.
If you are using MS VS 2003 or 2005 .NET and the MDX SDK from 2006 or 2007, then this is done for you. Can you load a project and execute it from the sample browser?

What are you using? MS VS 2002, 2003 or 2005 .NET? And what MDX SDK (don't just say "9" or "9c")?
I don't really have access to the computer right now but I'll find out and post it as soon as I do. Thanks guys!
Ok I'm on another computer and I downloaded DirectX from here:
http://www.softpedia.com/get/System/OS-Enhancements/DirectX-9.0c-Redistributable.shtml#

This is more of a problem with installation because once installed I can't find DirectX 'include', 'lib' folders in program files or in any search that I do.
For all DirectX downloads, you should be getting stuff from http://msdn2.microsoft.com/en-us/xna/aa937788.aspx

If you want to develop with DirectX, then the top download DirectX SDK February 2007 is what you are after. The installer for this should modify your Visual Studio executables, includes and libraries directories for you. If it doesn't then just add them in manually ...here are what it added to my VC++ directories in the order of executable files, include files and library files...
C:\Program Files\Microsoft DirectX SDK (February 2007)\Utilities\Bin\x86C:\Program Files\Microsoft DirectX SDK (February 2007)\IncludeC:\Program Files\Microsoft DirectX SDK (February 2007)\Lib\x86
If you are on a 64-bit operating system, then you will be after the x64 folder for libraries and not the x86 one. Your drive letter and folder location may of course vary from mine.

Regards,
ViLiO
Richard 'ViLiO' Thomasv.net | Twitter | YouTube
Quote:Original post by spaceJockey123
Ok I'm on another computer and I downloaded DirectX from here:
http://www.softpedia.com/get/System/OS-Enhancements/DirectX-9.0c-Redistributable.shtml#

This is more of a problem with installation because once installed I can't find DirectX 'include', 'lib' folders in program files or in any search that I do.



ummm... You have downloaded the run-time ONLY. YOU WANT the Direct X SDK! See above post - However I recommend the August 2006 Update unless you need DX 10?!
How could I have been so stupid?! Ok that's sorted now but I'm getting other errors in compiling this source code. Thing is the source code is not mine, it's from a website (http://larc.csci.unt.edu/sage/) so I'm assuming everything is correct. I'm just wondering if there are other settings I need to change. Somone suggested to add #pragma directive to header files with deprecated warnings but I don't think that's working.


c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
Camera.cpp
c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
CommonStuff.cpp
e:\demo 00\sage\source\windowswrapper\windowswrapper.h(37) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
EditTriMesh.cpp
e:\demo 00\sage\source\common\edittrimesh.cpp(2098) : error C2220: warning treated as error - no 'object' file generated
e:\demo 00\sage\source\common\edittrimesh.cpp(2098) : warning C4996: 'fopen' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(235) : see declaration of 'fopen'
Message: 'This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2100) : warning C4996: 'strcpy' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\string.h(74) : see declaration of 'strcpy'
Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2113) : warning C4996: 'strcpy' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\string.h(74) : see declaration of 'strcpy'
Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2117) : warning C4996: 'fscanf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(250) : see declaration of 'fscanf'
Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2121) : warning C4996: 'sprintf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(346) : see declaration of 'sprintf'
Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2131) : warning C4996: 'fscanf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(250) : see declaration of 'fscanf'
Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2153) : warning C4996: 'fscanf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(250) : see declaration of 'fscanf'
Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2154) : warning C4996: 'sprintf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(346) : see declaration of 'sprintf'
Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2158) : warning C4996: 'sprintf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(346) : see declaration of 'sprintf'
Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2166) : warning C4996: 'strcpy' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\string.h(74) : see declaration of 'strcpy'
Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2181) : warning C4996: 'sprintf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(346) : see declaration of 'sprintf'
Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2224) : warning C4996: 'fscanf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(250) : see declaration of 'fscanf'
Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2225) : warning C4996: 'sprintf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(346) : see declaration of 'sprintf'
Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2234) : warning C4996: 'strcpy' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\string.h(74) : see declaration of 'strcpy'
Message: 'This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2263) : warning C4996: 'fscanf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(250) : see declaration of 'fscanf'
Message: 'This function or variable may be unsafe. Consider using fscanf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
e:\demo 00\sage\source\common\edittrimesh.cpp(2264) : warning C4996: 'sprintf' was declared deprecated
c:\program files\microsoft visual studio 8\vc\include\stdio.h(346) : see declaration of 'sprintf'
Message: 'This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_DEPRECATE. See online help for details.'
FontCacheEntry.cpp
c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
Model.cpp
c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
Random.cpp
e:\demo 00\sage\source\common\random.cpp(7) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
Renderer.cpp
e:\demo 00\sage\source\windowswrapper\windowswrapper.h(37) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
TextureCacheEntry.cpp
c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
TriMesh.cpp
c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
Input.cpp
e:\demo 00\sage\source\input\input.cpp(35) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
GameBase.cpp
e:\demo 00\sage\source\input\input.h(39) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
IndexBuffer.cpp
c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
VertexBufferBase.cpp
c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
ResourceManager.cpp
c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
tinystr.cpp
e:\demo 00\sage\source\tinyxml\tinyxml.h(47) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
tinyxml.cpp
e:\demo 00\sage\source\tinyxml\tinyxml.h(47) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
tinyxmlerror.cpp
e:\demo 00\sage\source\tinyxml\tinyxml.h(47) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
tinyxmlparser.cpp
e:\demo 00\sage\source\tinyxml\tinyxml.h(47) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
AnimatedModel.cpp
c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
Generating Code...
Compiling...
DirectoryManager.cpp
e:\demo 00\sage\source\tinyxml\tinyxml.h(47) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
WindowsWrapper.cpp
e:\demo 00\sage\source\windowswrapper\windowswrapper.h(37) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
Generating Code...
Build log was saved at "file://e:\Demo 00\SAGE\Debug\BuildLog.htm"
SAGE - 22 error(s), 16 warning(s)
------ Build started: Project: Ned3D, Configuration: Debug Win32 ------
Compiling...
Game.cpp
c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
HelpText.cpp
c:\program files\microsoft directx sdk (december 2006)\include\d3d9.h(39) : fatal error C1083: Cannot open include file: 'objbase.h': No such file or directory
WinMain.cpp
e:\demo 00\sage\source\windowswrapper\windowswrapper.h(37) : fatal error C1083: Cannot open include file: 'windows.h': No such file or directory
You can fix the warning C4996 warnings by adding #pragma warning(disable: 4996) to the top of edittrimesh.cpp. The errors about missing include files look to be Win32 headers which suggests your include paths don't include the Platform SDK. Are you using Visual C++ Express edition? If so you'll have to download the Platform SDK from MSDN and set up your include directories to point to it. If you've got a full version of Visual Studio you should already have the Platform SDK and the directories should already be set up.

Game Programming Blog: www.mattnewport.com/blog

I am using Visual Express. Thank you very much, I will try what you suggested and post how it goes.

This topic is closed to new replies.

Advertisement