Reputation: 3410
I'm trying to build a solution that contains dozens of projects, unfortunately I cannot find a way in VS2013 to add a "global" include directory to the solution since I need to include Directx.
Is there really no other way in VS2013 to add directories to a solution besides of adding them manually project by project?
Upvotes: 1
Views: 314
Reputation: 41047
Starting with VS 2010, the correct way to add the DirectX SDK to a project is to use VC++ Directories settings. See this old VC post for details.
You can also use custom .props through Property Manager. This is how you would use the Windows 8.x SDK with VS 2010 for example because the Windows SDK no longer creates Platform Toolsets for this combination of tools. See this post.
Historically the include path order has been the following because the DirectX SDK contained newer headers than the Windows SDK 7.x and prior:
$(DXSDK_DIR)Include;$(IncludePath)
$(DXSDK_DIR)Lib\x86 or x64;$(LibraryPath)
Now that the DirectX SDK is deprecated, the Windows 8.x SDK that comes with VS 2012 and VS 2013 contains newer headers than the legacy DirectX SDK. Therefore, if you still need to make use of old components that are only in the DirectX SDK (such as the deprecated D3DX library), you need to use:
$(IncludePath);$(DXSDK_DIR)Include
$(LibraryPath);$(DXSDK_DIR)Lib\x86 or x64
There are a few more minor details covered on MSDN
For Direct3D 11 development, you should remove use of the DirectX SDK in favor of the Windows 8.x SDK anyhow. See Living without D3DX and DirectXMath.
If using XInput 1.3 and you still need to target Windows 7 or earlier, one option is to use XInput 9.1.0 instead. See XINPUT and Windows 8. This is used by DirectX Tool Kit's GamePad when targeting down-level to avoid the need for the legacy DirectX SDK.
The only cases where it still makes sense to involve the DirectX SDK in newer Win32 desktop apps is when using XAudio2 and shipping on Windows 7 or earlier. See XAudio2 and Windows 8. This is used by DirectX Tool Kit for Audio when targeting down-level.
In both cases of using XInput 1.3 and XAudio 2.7 you actually need to use full paths to the DirectX SDK headers/libs and not rely on project search paths to pick up the right headers since they have name collisions with XInput 1.4 and XAudio 2.8 in the Windows SDK 8.x.
Upvotes: 2