我正在尝试让 VSCode 编译 DS3 代码,我听说我需要这四个包含路径来编译 D3D 文件(包括 d3d12.h):
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
来源:我无法在 VSCode 中为 D3D12 配置包含路径
所以我确实包含了它们,但现在一个包含 windows.h 的简单文件不再编译。
我唯一的 cpp 中唯一的东西是:
#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>
这是我的 vs 代码任务和 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"
],
我在控制台中得到了这个:
执行任务: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:/程序文件 (x86)/Windows Kits/10/Include/10.0.17134.0/cppwinrt' <
在 C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/shared/minwindef.h:182:0 包含的文件中,
来自 C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/shared/windef.h:24,
来自 C:/Program Files (x86)/Windows Kits/10/Include/10.0.17134.0/um/windows.h:171,
来自 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"
错误“无目标架构”
如果我删除四个包含路径,我不会收到任何错误。有些东西告诉我,这不是我需要添加以包含 d3d12.h