'dxerr9.h': No such file or directory - c++

I am trying to compile a program I took off a cd from a book that uses directx to render 3d objects. when i press compile I get the following error
C1083: Cannot open include file: 'dxerr9.h': No such file or directory
I am using VC++ 2008 Express Edition and i am running off of Vista. I went to the following folder
[edit]
C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Include
I was able to find dxerr.h in the folder and the path is also being included in the VC++ Directories tab in the options window. dont know whats going on.

It seems your program was written using older version of DirectX SDK. The 'dxerr9.h' is present at least in "Microsoft DirectX 9.0 SDK (December 2004)", but is absent at least in "Microsoft DirectX SDK (August 2009)".

I think VitalyVal was right. about the following:
It seems your program was written using an older version of DirectX SDK. The 'dxerr9.h' is present at least in "Microsoft DirectX 9.0 SDK (December 2004)", but is absent at least in "Microsoft DirectX SDK (August 2009)".
I think the files now go by dxerr.h. I removed the 9 to the header and lib files and it worked.

That header was precisely duped in Aug2009 SDK, though that shouldn't surprise since it was already two years older DX versions had been deprecated, thus allowing for just a single library for everything.
By the way, people might be interested to check this post for a kind of more updated version.

Related

Cannot open source file d3dx9.h

Before I start off I know this is quite a common question, I did search for answers before posting here. Unfortunately, I had no luck.
In my code I include the file like this:
#include <d3dx9.h>
Now the error shows up: Cannot open source file d3dx9.h
In my Include Directories I did enter the path to where it is (if I look it up manually through my files, I can see it there).
The path is: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include
I also set the Library Directory: C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64
x64 since I am running a 64 bit system.
I'd highly appreciate it if someone could take the time to post a suggestion.
Greetings.
Visual Studio 2015 includes the Windows 8.1 SDK which is newer than the headers in the legacy DirectX SDK. The Windows 8.1 SDK includes all the DirectX headers and libraries, but does not contain the now deprecated D3DX (D3DX9, D3DX10, D3DX11) utility library which is why it is "missing".
D3DX9, D3DX10, and D3DX11 are only available in the legacy DirectX SDK. With VS 2010, the VC++ Directory settings you were supposed to use were as follows for Win32 (x86) settings:
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(DXSDK_DIR)Include;$(IncludePath)</IncludePath>
<LibraryPath>$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
and this for x64 native:
<ExecutablePath>$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86;$(ExecutablePath)</ExecutablePath>
<IncludePath>$(DXSDK_DIR)Include;$(IncludePath)</IncludePath>
<LibraryPath>$(DXSDK_DIR)Lib\x64;$(LibraryPath)</LibraryPath>
With VS 2012 or later, you have to reverse them since most of the headers in the Windows 8 SDK replace the older DirectX SDK:
<ExecutablePath>$(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x86</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x86</LibraryPath>
and
<ExecutablePath>$(ExecutablePath);$(DXSDK_DIR)Utilities\bin\x64;$(DXSDK_DIR)Utilities\bin\x86</ExecutablePath>
<IncludePath>$(IncludePath);$(DXSDK_DIR)Include</IncludePath>
<LibraryPath>$(LibraryPath);$(DXSDK_DIR)Lib\x64;</LibraryPath>
See MSDN, Where is the DirectX SDK (2015 Edition)?, The Zombie DirectX SDK, and Not So Direct Setup.
With all that said, you probably shouldn't be using legacy Direct3D 9 anyhow. Using DirectX 11 with one of the modern replacements for D3DX is a better, cleaner option and doesn't require the legacy DirectX SDK. See Living without D3DX.
If you are specifically targeting to run a program on Windows XP SP3 with Direct3D 9, you'll be using the v140_xp Platform Toolset which uses the Windows 7.1A SDK, not the Windows 8.1 SDK. Therefore, you go with the old-school include order. See this post for details.

Changing over from D3DX, D3DCompile not found

so far I've been succesfully changing from the deprecated D3DX libraries to the new ones, but with the function D3DX11CompileFromFile I'm supposed to use the new D3DCompileFromFile. MSDN says the header file is D3DCompiler.h and the lib file is D3DCompiler.lib. Intellisense picks up two, one from
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Lib\x64
and the other from
C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64
If anyone knows why this is happening I'd appreciate the help. I've also tried switching the orders of a few of them. Thanks.
Ideally you remove the DirectX SDK (June 2010) paths entirely and just use the D3DCompile header in the Windows 8.1 SDK.
If you have to use the legacy DirectX SDK (June 2010), you put those include & lib paths after the Windows 8.1 SDK. This mostly works, but there are complications with respect to down-level XAudio 2.7. See The Zombie DirectX SDK for all the details.
The legacy DirectX SDK copy of d3dcompiler.h doesn't have the FromFile flavor which was added for the Windows 8.x SDK version. On Windows 8.1 or Windows 10, D3DCompiler_47.DLL is part of the OS, but if you want to run on Windows 7 you need to deploy the DLL with your application which you can just copy out of $(WindowsSdkDir)redist\d3d\<arch>\D3DCompile*.DLL. See HLSL, FXC, and D3DCompile.

C++ Compiling Linking

I am currently getting into some DirectX Programming and just installed the DX-SDK. However, when I open the most basic sample File (Tutorial01, just displays a blue background) in Visual Studio (2012, but that seems to be irrelevant) and compile it I get a working output.
When I start an empty c++ project, make a new file called main.cpp and copy and paste the code from the tutorial, do the same with the resource.h file and also go to Project settings->Configuration Properties->Linker and copy the "Input" from the sample to my own project and then compile my project I get the following error output:
fatal error C1083: Cannot open include file: 'd3dx11.h': No such file or directory
The Header is included via #includein both, the sample and my project. However my project won't compile.
Your new project is missing VC++ Directories settings to find the DirectX SDK include/lib paths. Starting with VS 2010, you have to explicitly set up the include/lib paths to get the DirectX SDK integrated with Visual Studio.
Since you are trying to use VS 2012 with the legacy DirectX SDK, you should be aware that the VC++ Directories settings for VS 2010 are backwards from what you should be using with VS 2012/VS2013. This is because the Windows 8.x SDK includes newer versions of most of the DirectX headers in the now outdated and deprecated legacy DirectX SDK.
The further complication is that D3DX is not present in the Windows 8.x SDK and is itself deprecated. You can make it work per the instructions on MSDN, but keep in mind there are now alternatives to using D3DX for Direct3D 11 you should consider.

Where can I find 'winmm.lib' (I'm using Visual Studio 2012)

My OS is 64Bit Windows 7.
I wanted to build the DirectX Sample in
C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Samples\C++\Direct3D10\Tutorials\Tutorial02.
but when I build error occured with fatal error
LNK1104: 'winmm.lib' can't open the file.
I reinstalled Direct SDK, but no change. I also added the path (include, lib) to the settings.
If I remove 'winmm.lib' from the project settings, 'comctl32.lib' can't be opened.
both libs were already present in properties>Linker>Input.
How can I solve this problem?
Just put the line below in stdafx.h
#pragma comment(lib, "winmm.lib")
winmm.lib isn't part of the DirectX SDK but is part of the Windows SDK.
Latest Windows SDK versions were also heavily reorganized but it includes the library you're looking for.
If you are trying to build any of the legacy DirectX SDK samples with VS 2012 or VS 2013, you need to modify the include/libs paths per the instructions on bottom of the page on MSDN. The most important change is that you must reverse the Include/Lib path order:
For VS 2010 it was:
$(DXSDK_DIR)Include;$(IncludePath)
$(DXSDK_DIR)Lib\x86;$(LibraryPath) or $(DXSDK_DIR)Lib\x64;$(LibraryPath)
For VS 2012/2013 it has to be:
$(IncludePath);$(DXSDK_DIR)Include
$(LibraryPath);$(DXSDK_DIR)Lib\x86 or $(LibraryPath);$(DXSDK_DIR)Lib\x64
Of course a better option is not spend time learning the older Direct3D 10 API at all, and use the latest Direct3D 11 Win32 desktop tutorials on MSDN Code Gallery. In fact, I've posted many of the legacy DirectX SDK samples there so they work fine with VS 2012/2013 Express for Windows Desktop and VS 2012/2013 Pro+ as-is without the DirectX SDK at all.
Read these blog posts:
DirectX SDK Samples Catalog
DirectX SDK Tools Catalog
Living without D3DX
DirectX SDKs of a certain age
And review these CodePlex projects:
DirectX Tool Kit
DirectXMesh
DirectXTex
DXUT for Direct3D 11
Effects 11

Compile using Direct X June 2010 SDK on Visual Studio 2012

I want to use the June 2010 SDK rather than the Windows 8 SDK to compile my DirectX code in Visual Studio 2012 on Windows 8 Release Candidate.
The problem is that since the DirectX 8 SDKs are in the same folder as the Windows SDK, I don't know which include/library folders I can change.
As it stands, seemingly nothing I change in the directory settings or the linker settings solves the issue of something or another referring to the Windows 8 SDK, which causes a bunch of redefinition warnings among other things.
Has anyone been able to get this to work?
Not sure this is the easiest way, but I ended up installing VS2010 and compiling that way.
As a side note, the DirectX June 2010 SDK fails to install correctly (probably for Windows 8 reasons), but it leaves the \program files folder intact when it finishes -- so all the .libs and .hs are there to use.