1

我想在 Windows 下使用 Clang-Cl 来构建我的项目。作为生成器,我使用 Ninja,我的 IDE 是我最近切换到的 Visual Studio Code。VS Code 使用编译器工具包

{
 "name": "Clang 9.0.0 für MSVC mit Visual Studio Build Tools 2019 Release (amd64)",
 "visualStudio": "8b490674",
 "visualStudioArchitecture": "amd64",
 "compilers": {
   "C": "C:\\LLVM\\bin\\clang-cl.exe",
   "CXX": "C:\\LLVM\\bin\\clang-cl.exe"
 }
}, ...

Cmake Tools Extension 现在已成功配置我的项目,我遇到的问题是由于错误太多而导致构建停止。我正在构建一个调试版本,所以我不确定编译器工具包是否已经错误,因为它说的是 Release。将套件中的架构切换为 "visualStudioArchitecture": "x64" 什么都不做。这是我得到的错误列表

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include\vcruntime_exception.h(28,5): error: unknown type name 'bool'; did you mean 'Bool'?

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include\vcruntime_exception.h(32,11): error: must use 'struct' tag to refer to type '__std_exception_data'

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include\vcruntime_exception.h(44,1): error: unknown type name 'namespace'

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include\vcruntime_exception.h(44,14): error: expected ';' after top level declarator

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include\exception(205,81): error: expected function body after function declarator

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include\limits(23,1): error: expected ';' after top level declarator

C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\include\limits(23,1): error: unknown type name 'namespace'

除了选择编译器工具包外,我没有更多的设置。有谁知道可能缺少什么?

这是来自 VS Code 的最终错误

[build] fatal error: too many errors emitted, stopping now [-ferror-limit=]
[build] 20 errors generated.
[build] ninja: build stopped: subcommand failed.
[build] Der Build wurde mit dem Exitcode 1 abgeschlossen.

我也试过 CLion,有同样的问题,但错误输出看起来有点不同

fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
NMAKE : fatal error U1077: "C:\LLVM\bin\clang-cl.exe": Rückgabe-Code "0x1"
Stop.
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\nmake.exe"": Rückgabe-Code "0x2"
Stop.
NMAKE : fatal error U1077: ""C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.26.28801\bin\HostX64\x64\nmake.exe"": Rückgabe-Code "0x2"
Stop.
4

0 回答 0