0

[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://learn.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 Answers1

2

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.

Chuck Walbourn
  • 38,259
  • 2
  • 58
  • 81
  • Thanks for your answer. Does that apply to vsCode ? Or did you understand I am using visual studio ? I made an edit clarifying that the question is about a vsCode project. – OeilDeLance Sep 06 '18 at 10:41
  • My point is that you need more than one directory added to your include and lib path for Windows 10 SDK headers/libs. That's true for any toolset you are using. Visual Studio has it all integrated already, but it's still using them. – Chuck Walbourn Sep 06 '18 at 16:22
  • I added the four include paths but I am getting errors with code simply including I have the impression it is because compiler is now getting winnt.h (inculde from windows.h) from the wrong dir : apparently C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/um – OeilDeLance Sep 06 '18 at 20:28
  • Actually the file that causes the error: > error: #error "No Target Architecture" is "windef.h" not "winnt.h" I edited the top post to reflect the entirety of the problem – OeilDeLance Sep 09 '18 at 10:43
  • You have morphed your question, and should open a new one for the new issue. The problem is no longer "configuring include paths". Your problem is now "Getting GNU G++ to build for the Windows platform" – Chuck Walbourn Sep 10 '18 at 05:35
  • I agree that I should probably open a new question but I am not sure it would be "Getting GNU G++ to build for the Windows platform" I got g++ to compile it only stopped compiling after I added the windows kit include paths. Perhaps the new title should "Getting GNU G++ to build with D3D12 and VSCode" ? But the content of the post wouldn't be so different than what it is at the moment. Should I modify the title of the question ? – OeilDeLance Sep 13 '18 at 20:04
  • Another title idea: "GNU G++ stops compiling after including D3D12 include paths" – OeilDeLance Sep 13 '18 at 20:37
  • Okay I posted a new question here: https://stackoverflow.com/questions/52431353/gnu-g-stops-compiling-after-including-d3d12-include-paths-using-vscode – OeilDeLance Sep 20 '18 at 18:43