Followers 0

# Using environment variables in include directive

## 2 posts in this topic

Hi,

I'm trying to get the pre-Windows 8 XAudio2 headers from the DirectX SDK to work under VS2012.
At one point the documentation tells me to add the following line of code...

#include <%DXSDK_DIR%Include\xaudio2.h>

..., which doesn't work: cannot open include file.

I assume this is because it's not possible to literally specify environment variables this way?
0

##### Share on other sites
[quote name='eppo' timestamp='1353957508' post='5004273']At one point the documentation tells me to add the following line of code...
[code]#include <%DXSDK_DIR%Include\xaudio2.h>[/code][/quote]
Do you have a link to the documentation? I'd like to see some context for this code.

[quote]I assume this is because it's not possible to literally specify environment variables this way? [/quote]
No, it is not possible. What I'm assuming is implied by the code is:
1. Add [tt]$(DXSDK_DIR)\Include[/tt] to the include path of your [tt]Microsoft.win32.cpp.user[/tt] properties sheet. 2. Add [tt]$(DXSDK_DIR)\Lib\x86[/tt] to the library path of your [tt]Microsoft.win32.cpp.user[/tt] properties sheet.
3. Include [tt]<xaudio2.h>[/tt]
0

##### Share on other sites
Here is the specific page: http://msdn.microsoft.com/en-us/library/windows/desktop/ee663275.aspx

I already have this working, but the thing is: you have to add the complete path to the header files (#include <C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include/xaudio2.h>), otherwise they will conflict with the newer headers from the Windows 8 SDK.
0

## Create an account

Register a new account