2
votes

I am trying to set up DirectX in my C++ project in Visual Studio 2015.

I have DirectX SDK installed in D:\Program Files (x86)\DirectX SDK, and my environment variable is called DXSDK_DIR.

In Visual Studio, I tried to add it to C/C++ --> General --> Additional Include Directories in all of the following ways:

$(DXSDK_DIR)\Include

%(DXSDK_DIR)\Include%

%"(DXSDK_DIR)\Include"%

%(DXSDK_DIR)%\Include

but none of them seemed to work.

1
Did you restart Visual Studio after setting the environment variable? Programs inherit environment variables from their parent, at the moment of process creation. Altering environment variables in the parent after the child has been created won't affect the child. This includes the common case where the parent is Windows Explorer aka the Shell. - MSalters
There is no separate DirectX SDK anymore. It became a part of Windows SDK which is typically installed along with Visual Studio or can be installed separately later. - user7860670

1 Answers

0
votes

For some reason, the environment variable's value is not D:\Program Files (x86)\DirectX SDK, as I expected, but only D:\Program Files (x86).

So, I guess the solution is to modify the environment variable so that it points to the DirectX SDK folder, and in Visual Studio add

%DXSDK_DIR%\Include

in C/C++ --> General --> Additional Include Directories

and

%DXSDK_DIR%\Lib

in Linker --> General --> Additional Library Directories.