无法在 Windows 11 上安装正确的 Clang 版本

问题描述 投票:0回答:1

我目前在 Windows 11 计算机上安装了 neovim,但是我想运行 C++ 代码。我有一个简单的文件,其中包含经典的 print Hello World 但是,当我使用 clang++ 运行它时遇到问题:

C:\Users\username\OneDrive\Desktop\Testing>clang++ testing.cpp
In file included from testing.cpp:1:
In file included from C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\iostream:8:
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\yvals_core.h:887:1: error:
      static_assert failed "Error in C++ Standard Library usage."
_EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 16.0.0 or newer.");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.38.33130\include\yvals_core.h:514:5: note:
      expanded from macro '_EMIT_STL_ERROR'
    static_assert(false, "Error in C++ Standard Library usage.")
    ^             ~~~~~
1 error generated.

我已经使用choco安装了最新版本的LLVM,当检查clang的当前版本时,我有:

C:\Users\username\OneDrive\Desktop\Testing>clang++ --version
compnerd.org clang version 14.0.0
Target: x86_64-unknown-windows-msvc
Thread model: posix
InstalledDir: C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr\bin

我还安装了 Visual Studio 代码以通过那里下载 clang 并通过 Visual Studio 终端运行代码,但出现相同的错误。我还应该尝试什么吗?

c++ clang llvm neovim
1个回答
0
投票

解决了问题。我基本上找到了环境变量C:/Program Files/LLVM/bin并将其向上移动以便PATH可以识别它

© www.soinside.com 2019 - 2024. All rights reserved.