I can't configure include paths in VSCode for D3D12

青春壹個敷衍的年華 提交于 2019-12-11 16:05:55

问题


[EDIT] This is about a vsCode project not a visual studio project (clarified here because it is not obvious)

Did anyone managed to build an app that includes d3d12.h and links successfully with the D3D lib. I know it lives in C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um But when I add it to the include paths of c_cpp_properties.json I get this error:

cannot open source file "kernelspecs.h" (dependency of "d3d12.h")

Which makes sense.

This page mentions a DXSDK_DIR environment var but it is not defined on my computer although I have "Windows 10 SDK software" and "VS community 2017" installed. https://docs.microsoft.com/en-us/windows/desktop/direct3d12/directx-12-programming-environment-set-up

I have the impression it is impossible to build a D3D12 App with VSCode right now. Am I wrong ?

[Edit] Okay so I added all four include paths in this way (I am using g++):

 "command": "${env:Cygwin64BinPath}/g++.exe",
        "args": 
        [
            "-g", 
            "-o", "MassiveSteering", 
            "*.cpp", 
            "-D_DEBUG",
            "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/shared",
            "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/um",
            "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/winrt",
            "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/cppwinrt"
        ],

But I get the following error:

Executing task: C:\cygwin64\bin/g++.exe -g -o MassiveSteering *.cpp -D_DEBUG '-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/shared' '-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/um' '-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/winrt' '-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/cppwinrt' <

In file included from C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/shared/minwindef.h:182:0,

from C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/shared/windef.h:24,

from C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/um/windows.h:171,

from main.cpp:7: C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/um/winnt.h:154:2: error: #error "No Target Architecture"

The only thing in my only cpp is :

#define UNICODE // Necessary to use long chars in windows 
#define _UNICODE

#define WIN32_LEAN_AND_MEAN

// include the basic windows header file
#include <windows.h>

回答1:


The standard Visual Studio integration has all of the following four INCLUDE paths:

C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\um
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\winrt
C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\cppwinrt

If you just used um, that's why it failed.

For LIB you need:

C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\ucrt\<arch>
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.17134.0\um\<arch>

DXSDK_DIR environment variable is an outdated reference to the Beta version of DirectX 12 SDK which shouldn't be there anymore because it doesn't exist outside of the Beta. The DirectX 12 headers & libs are part of the Windows 10 SDK.

The D3DX12.H utility header is not in any SDK, you just get it from GitHub.

You may also want to check out the DirectX Tool Kit for DirectX 12.



来源:https://stackoverflow.com/questions/52156684/i-cant-configure-include-paths-in-vscode-for-d3d12

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!