Visual Studio无法检测到我的Clang编译器安装

时间:2019-07-29 20:48:37

标签: c++ visual-studio cmake clang visual-studio-2019

我正在使用最新的VS 2019 16.2,它应该具有支持MSBuild的Clang以及当然带有CMake的Clang。

我安装了CMake组件以及v142生成工具的Clang-cl(但没有安装VS附带的Clang编译器组件!),因为我已经在系统的默认路径中安装了Clang编译器v8.0.0。

我想使用Clang(通过MSBuild或CMake),但两种方法均失败。
VS似乎根本无法检测到我的编译器(尽管应该支持该版本)。

有没有一种方法可以手动使它检测到它?可能会在某些选项中添加路径或重新安装clang?
出于特定原因,我不想安装VS。

enter image description here

enter image description here

    Severity    Code    Description Project File    Line    Suppression State
Error       CMake Error at C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.14/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "c:/program files (x86)/microsoft visual studio/2019/community/VC/Tools/Llvm/8.0.0/bin/clang-cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/HP/Source/Repos/CMakeProject1/out/build/x64-Clang-Debug/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_8f083 
    [1/2] Building C object CMakeFiles\cmTC_8f083.dir\testCCompiler.c.obj
    [2/2] Linking C executable cmTC_8f083.exe
    FAILED: cmTC_8f083.exe 
    cmd.exe /C "cd . && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_8f083.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests  -- C:\PROGRA~2\MICROS~1\2019\COMMUN~1\VC\Tools\MSVC\1422~1.279\bin\Hostx86\x86\link.exe /nologo CMakeFiles\cmTC_8f083.dir\testCCompiler.c.obj  /out:cmTC_8f083.exe /implib:cmTC_8f083.lib /pdb:cmTC_8f083.pdb /version:0.0  /machine:X86  /debug /INCREMENTAL /subsystem:console  kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cd ."
    RC Pass 1: command "rc /foCMakeFiles\cmTC_8f083.dir/manifest.res CMakeFiles\cmTC_8f083.dir/manifest.rc" failed (exit code 0) with the following output:
    The system cannot find the file specified
    ninja: build stopped: subcommand failed.
  CMake will not be able to correctly generate this project.        C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.14/Modules/CMakeTestCCompiler.cmake  60  

enter image description here

0 个答案:

没有答案