# Visual Studio 2012 and DirectX SDK

Posted on Jan 12, 2013

The DirectX SDK is included as part of the Windows SDK, starting from Windows 8. However, D3DX is not considered the canonical API for using Direct3D in Windows 8 and therefore isn’t included in the Windows SDK shipped with Visual Studio 2012. So, when you compile an old project which depends on D3DX, you still need to get “d3dx9.h”, “d3dx10.h”, or “d3dx11.h” from the June 2010 DirectX SDK. This causes a confliction between the June 2010 DirectX SDK and the DirectX SDK included in the Windows SDK (ver 8.0). For example, you will see a bunch of warning C4005 like the following.

```6>C:\Program Files\Microsoft DirectX SDK (June 2010)\Include\D2DErr.h(59): warning C4005: 'D2DERR_WRONG_STATE' : macro redefinition
6>          C:\Program Files\Windows Kits\8.0\Include\shared\winerror.h(49859) : see previous definition of 'D2DERR_WRONG_STATE'
6>C:\Program Files\Microsoft DirectX SDK (June 2010)\Include\D2DErr.h(64): warning C4005: 'D2DERR_NOT_INITIALIZED' : macro redefinition
6>          C:\Program Files\Windows Kits\8.0\Include\shared\winerror.h(49868) : see previous definition of 'D2DERR_NOT_INITIALIZED'
6>C:\Program Files\Microsoft DirectX SDK (June 2010)\Include\D2DErr.h(69): warning C4005: 'D2DERR_UNSUPPORTED_OPERATION' : macro redefinition
6>          C:\Program Files\Windows Kits\8.0\Include\shared\winerror.h(49877) : see previous definition of 'D2DERR_UNSUPPORTED_OPERATION'
6>C:\Program Files\Microsoft DirectX SDK (June 2010)\Include\D2DErr.h(74): warning C4005: 'D2DERR_SCANNER_FAILED' : macro redefinition
6>          C:\Program Files\Windows Kits\8.0\Include\shared\winerror.h(49886) : see previous definition of 'D2DERR_SCANNER_FAILED'
6>C:\Program Files\Microsoft DirectX SDK (June 2010)\Include\D2DErr.h(79): warning C4005: 'D2DERR_SCREEN_ACCESS_DENIED' : macro redefinition
6>          C:\Program Files\Windows Kits\8.0\Include\shared\winerror.h(49895) : see previous definition of 'D2DERR_SCREEN_ACCESS_DENIED'
6>C:\Program Files\Microsoft DirectX SDK (June 2010)\Include\D2DErr.h(84): warning C4005: 'D2DERR_DISPLAY_STATE_INVALID' : macro redefinition
6>          C:\Program Files\Windows Kits\8.0\Include\shared\winerror.h(49904) : see previous definition of 'D2DERR_DISPLAY_STATE_INVALID'
6>C:\Program Files\Microsoft DirectX SDK (June 2010)\Include\D2DErr.h(89): warning C4005: 'D2DERR_ZERO_VECTOR' : macro redefinition
6>          C:\Program Files\Windows Kits\8.0\Include\shared\winerror.h(49913) : see previous definition of 'D2DERR_ZERO_VECTOR'
6>C:\Program Files\Microsoft DirectX SDK (June 2010)\Include\D2DErr.h(97): warning C4005: 'D2DERR_INTERNAL_ERROR' : macro redefinition
...```

To prevent these warnings, make it sure that you are picking up “d3d9.h”, “d3d10.h” and “dxgi.h”, or “d3d11.h” and “dxgi.h” from the Windows SDK, not from the June 2010 DirectX SDK, whenever “d3dx9.h”, “d3dx10.h”, or “d3dx11.h” is included in your project. One easy way to achieve this is to put the path of the June 2010 DirectX SDK after that of the Windows SDK in the include directory list.