0

It seems no matter what I try I won't get directx 11 application to compile. I tried:

  • Installing DirectX June 2010 and add $(IncludePath);$(DXSDK_DIR)Include and $(LibraryPath);$(DXSDK_DIR)Lib\x86 to VS2015 for Include Directories and Library Directories, it finds d3d11.h but says d3d11.lib isn't there. (Source)
  • Tried removing DirectX June 2010 and rely on Win10's ("C:\Program Files (x86)\Windows Kits\10\Include\10.0.14393.0\um") d3d11.h ... VS2015 says it's not here

What am I doing wrong?

Thanks!

Community
  • 1
  • 1
ChaoSXDemon
  • 860
  • 10
  • 29
  • https://msdn.microsoft.com/en-gb/library/windows/desktop/ee663275(v=vs.85).aspx – Richard Critten Feb 04 '17 at 00:41
  • Are you suggesting I don't have the SDK even though I have installed it while installing VS2015? – ChaoSXDemon Feb 04 '17 at 01:54
  • Actually doing that makes it so that my VS2015 unable to find d3d11.dll – ChaoSXDemon Feb 04 '17 at 01:59
  • With VS 2015, a Win32 classic desktop application will default to building with the Windows 8.1 SDK. This means that it can find ``#include `` and ``#include `` by default. It won't, however, be able to find ``#include `` which is the deprecated D3DX11 utility header that's only in the legacy DirectX SDK. What error exactly are you seeing? – Chuck Walbourn Feb 04 '17 at 06:51
  • You should install the [Direct3D Game VS Template](https://github.com/walbourn/directx-vs-templates/wiki) and instantiate Direct3D Win32 Game to verify you have your VS 2015 set up correctly. – Chuck Walbourn Feb 04 '17 at 06:53
  • I know the d3dx11.h is an extension that's got things to ease the development process but I'm having trouble with d3d11.h. VS2015 simply says it cannot find "d3d11.h" from the line "#include ". Installing DirectX SDK June 2010, it says cannot find d3d11.dll. Searching d3d11.h, I can see that file to be there in win7, win8 and win10 include folders. – ChaoSXDemon Feb 04 '17 at 07:19
  • It seems including those paths don't work but instead #pragma comment(lib, "d3d11.lib") works. – ChaoSXDemon Feb 06 '17 at 17:54
  • @ChaoSXDemon I would repair your installation, those headers are there by default so the best I can assume is your install or project is borked – Mgetz Feb 08 '17 at 21:04

3 Answers3

1

@MaverickATC I ran into this exact issue today. I was unable to build one of the sample DirectX (Tutorial01) and was getting a link error on 'D3D11CreateDevice' I attempted to add the library 'd3d11.lib' through Project -> Linker settings but got the same issue. Adding the:

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

to the beginning of my code resolved the issue and allowed build without errors.

I find this odd because in my mind they should be doing the same thing as pointed out by @Vic but in this instance #pragma worked for me.

0

If you are using Windows SDK, you should also include dxgi header and library, and d3dcompiler header and library to compile shaders:

#include <d3d11.h>
#include <dxgi.h>
#include <d3dcompiler.h>
#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "d3dcompiler.lib")
0

@MaverickATC is right in some degree. DirectX June 2010 or Win8/Win10 both work. If you need d3d11.lib, you should add it manually to projection property, you do have d3d11.lib in you Sdk(DirectX June 2010 or Win8/Win10, you can try search),and you just add a name "d3d11.lib" to projection property -> link -> additional rely lib. because vs2015 can search you environment path to find it. dxgi.h is use to get DXGI API, is a low layer of d3d11, but it is not necessary. So do not d3dcompiler, which is for compile d3d shader.