D3D11CreateDevice 0x887a002d error
Asked Answered
L

1

6

First I am learning DirectX 11 from Frank Luna book I came to the part where I need to create the device, but it gives the error: "0x887a002d: The application requested an operation that depends on an SDK component that is missing or mismatched." I kept searching, I tried deferent solutions but nothing did it,

Solutions I tried: 1)I am using the DirectX library that comes with visual studio 2015, so I installed it.(correctly) 2)I tried changing it to D3D11CreateDeviceAndSwapChain but it also gave the same error

I have DirectX SDK(June 2010) hooked up to the project(and yes I want to use DirectX legacy SDK).

My code:

HRESULT hr;
UINT CreateDeviceFlags = 0;
D3D_FEATURE_LEVEL featureLevel;
UINT m4xMsaaQuility;


    #if defined(DEBUG) || defined(_DEBUG)
      CreateDeviceFlags |= D3D11_CREATE_DEVICE_DEBUG;
    #endif

hr = D3D11CreateDevice(
    0,
    D3D_DRIVER_TYPE_HARDWARE,
    0,
    CreateDeviceFlags,
    0, 0,
    D3D11_SDK_VERSION,
    &m_pDevice,
    &featureLevel,
    &m_pDeviceContext);

if (FAILED(hr))
{
    return -1;
}

Includes:

#include <iostream>
#include <Windows.h>

#include <d3d11.h>
#include <d3dcompiler.h>
#include <DirectXMath.h>
#include <DirectXColors.h>

// Link Library Dependencies
#pragma  comment(lib, "d3d11.lib")
#pragma  comment(lib, "dxgi.lib")
#pragma  comment(lib, "d3dcompiler.lib")
#pragma  comment(lib, "winmm.lib")
Lessen answered 2/6, 2017 at 17:13 Comment(3)
"I tried different solutions" Then list what you already tried.Haircloth
1)I am using the directx library that comes with visual studio 2015, so I installed it.(correctly) 2)I tried changeing it to D3D11CreateDeviceAbdSwapChain but gave the same errorLessen
Edit your question to include that.Haircloth
L
12

You have not mentioned which OS you are using.

The error indicates that your system does not have the DirectX SDK Layer package that is required to support D3D11_CREATE_DEVICE_DEBUG. You can verify that by building a Release configuration which won't use this flag and check that it can create the Direct3D 11 device.

The legacy DirectX SDK (even the last one, June 2010) only installs the DirectX Developer Debug Runtime for Windows 7 or earlier when using DirectX 11.0. It does not support Windows 7 SP1 with KB 2670838 (a.k.a DirectX 11.1), Windows 8, Windows 8.1, or Windows 10.

  • If you are using Windows 7 SP1 with KB 2670838, then you should get the proper Debug SDK Layers from installing the Windows 8.1 SDK (which is included with VS 2015). See DirectX 11.1 and Windows 7 Update.

  • If you are using Windows 8, Windows 8.1, or Windows 8.1 Update, then you should get the proper Debug SDK Layers from installing the Windows 8.1 SDK (which is included with VS 2015). Note that Windows 8 is not supported anymore, so you should be sure to move to Windows 8.1 Update or Windows 10.

  • If you are using Windows 10, then you need to enable the Graphics Tools Windows feature which provides the Debug SDK Layer that matches your current build of Windows 10. Keep in mind that this is OS version specific so upgrading to newer builds or Insider builds may require reinstalling the Windows feature. In Enterprise settings, your IT admin has to approve the use of this Windows optional feature for you to be able to install it. See Visual Studio 2015 and Graphics Tools for Windows 10

See Where is the DirectX SDK (2015 Edition)? and Direct3D SDK Debug Layer Tricks

Frank Luna's book is great, but was written before the deprecation of the DirectX SDK. Read this blog post for some important notes. Be sure to read Living without D3DX and consider using the latest version of Effects 11 from GitHub.

As you are new to DirectX 11, I strongly recommend taking a look at Anatomy of Direct3D 11 Create Device as well as the DirectX Tool Kit for DirectX 11 tutorials. It would probably serve you well to do it before working through all of Luna's book so you can get a foundation in the 'modern' way to work with DirectX 11. This will let you more easily discern the deprecated stuff in Luna's book from the parts that are still quite relevant.

Lugworm answered 2/6, 2017 at 18:48 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.