Visual Studio 2022 #include Directory does not start at the source file

499 views Asked by At

After installing DirectX SDK June 2010, all of my #include's are now not found since it is searching for files inside of that SDK.

When I write #include "file.h", I expect to include the file that is in the same directory as the source file, visual studio, instead searches for file.h in the directory of DirectX sdk instead of the source file directory

Here is an image to help you understand: enter image description here

I've tried to reinstall visual C++ and reset project parameters in VC++ tab, but it did not help

1

There are 1 answers

0
Chuck Walbourn On

TL;DR: Don't use the legacy DirectX SDK. The modern Windows SDKs that come with Visual Studio dating back to VS 2012 already includes everything you need including the HLSL compiler, Direct3D headers & libraries, etc.

If you want to make use of legacy D3DX9, D3DX10, and/or D3DX11 in your project, use the NuGet package instead.

You can use the legacy DirectX SDK, but you have to manually add the proper INCLUDE/LIB paths to the VC++ Directories settings even back in Visual Studio 2010. The key issue is that many of the headers the legacy DirectX SDK are OLDER than the system headers in the modern Windows SDK, so you have be careful about search order and apply some hacks depending on what of the old content you are using. All the details for this are on Microsoft Docs. The simpler answer is don't use it at all.

For lots and lots of background and detail, see these blog posts:

https://walbourn.github.io/where-is-the-directx-sdk-2021-edition/

https://walbourn.github.io/legacy-d3dx-on-nuget/

https://walbourn.github.io/the-zombie-directx-sdk/

https://walbourn.github.io/living-without-d3dx/

https://walbourn.github.io/directx-sdk-tools-catalog/

https://walbourn.github.io/directx-sdk-samples-catalog/