吾爱破解 - LCG - LSG |安卓破解|病毒分析|www.52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 1061|回复: 4
收起左侧

[其他求助] CMake报错求助

[复制链接]
电竞教父肖巴金 发表于 2022-8-25 21:28
25吾爱币
本帖最后由 电竞教父肖巴金 于 2022-8-27 19:04 编辑

2022/08/27
受回答启发,已找到直接原因,当初安装vs时路径设置在了其他盘,后来某一天请理文件时把vs的下载缓存删了。
根本原因还是不知道,大概是缓存一删,vs就找不到自己装在哪里了吧。


因水平不足,可能存在无法对问题进行准确的描述、提供有效信息等问题,可以的话请您指正。
问题描述: CMake报错,无法使用vs编译程序。MinGW正常。

以下为Clion中报错情形和报错提示:
-- The C compiler identification is MSVC 19.30.30705.0
-- The CXX compiler identification is MSVC 19.30.30705.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: D:/Tools/Visual Studio/2022/Pro/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: D:/Tools/Visual Studio/2022/Pro/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - broken
CMake Error at D:/Tools/Clion/CLion 2021.2.3/bin/cmake/win/share/cmake-3.20/Modules/CMakeTestCCompiler.cmake:66 (message):
  The C compiler

    "D:/Tools/Visual Studio/2022/Pro/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/BarkingX/AppData/Local/Temp/cmake_check_environment/_build16265090609187236484/CMakeFiles/CMakeTmp
   
    Run Build Command(s):nmake -f Makefile /nologo cmTC_1bffd\fast &&         "D:\Tools\Visual Studio\2022\Pro\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64\nmake.exe"  -f CMakeFiles\cmTC_1bffd.dir\build.make /nologo -L                  CMakeFiles\cmTC_1bffd.dir\build
    Building C object CMakeFiles/cmTC_1bffd.dir/testCCompiler.c.obj
            "D:\Tools\Clion\CLion 2021.2.3\bin\cmake\win\bin\cmake.exe" -E cmake_cl_compile_depends --dep-file=CMakeFiles\cmTC_1bffd.dir\testCCompiler.c.obj.d --working-dir=C:\Users\BarkingX\AppData\Local\Temp\cmake_check_environment\_build16265090609187236484\CMakeFiles\CMakeTmp --filter-prefix="娉ㄦ剰: 鍖呭惈鏂囦欢:  " -- D:\Tools\VISUAL~1\2022\Pro\VC\Tools\MSVC\1430~1.307\bin\Hostx64\x64\cl.exe @C:\Users\BarkingX\AppData\Local\Temp\nm9CFE.tmp
    testCCompiler.c
    Linking C executable cmTC_1bffd.exe
            "D:\Tools\Clion\CLion 2021.2.3\bin\cmake\win\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_1bffd.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- D:\Tools\VISUAL~1\2022\Pro\VC\Tools\MSVC\1430~1.307\bin\Hostx64\x64\link.exe /nologo @CMakeFiles\cmTC_1bffd.dir\objects1.rsp @C:\Users\BarkingX\AppData\Local\Temp\nm9D6C.tmp
    RC Pass 1: command "rc /fo CMakeFiles\cmTC_1bffd.dir/manifest.res CMakeFiles\cmTC_1bffd.dir/manifest.rc" failed (exit code 0) with the following output:
    绯荤粺鎵句笉鍒版寚瀹氱殑鏂囦欢銆侼MAKE : fatal error U1077: 鈥�"D:\Tools\Clion\CLion 2021.2.3\bin\cmake\win\bin\cmake.exe"鈥�: 杩斿洖浠g爜鈥�0xffffffff鈥�
    Stop.
    NMAKE : fatal error U1077: 鈥�"D:\Tools\Visual Studio\2022\Pro\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64\nmake.exe"鈥�: 杩斿洖浠g爜鈥�0x2鈥�
    Stop.
   
   

  

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!
See also "C:/Users/BarkingX/AppData/Local/Temp/cmake_check_environment/_build16265090609187236484/CMakeFiles/CMakeOutput.log".
See also "C:/Users/BarkingX/AppData/Local/Temp/cmake_check_environment/_build16265090609187236484/CMakeFiles/CMakeError.log".

错误代码: 1

以下为VS2022中报错情景和报错提示:
CMake Error at D:/Tools/Visual Studio/2022/Pro/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "D:/Tools/Visual Studio/2022/Pro/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: D:/Data/CLionProjects/temp/selection_sort/out/build/x64-Debug/CMakeFiles/CMakeTmp
   
    Run Build Command(s):D:/Tools/Visual Studio/2022/Pro/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_cc420 && [1/2] Building C object CMakeFiles\cmTC_cc420.dir\testCCompiler.c.obj
    [2/2] Linking C executable cmTC_cc420.exe
    FAILED: cmTC_cc420.exe
    cmd.exe /C "cd . && "D:\Tools\Visual Studio\2022\Pro\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_cc420.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests  -- D:\Tools\VISUAL~1\2022\Pro\VC\Tools\MSVC\1430~1.307\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_cc420.dir\testCCompiler.c.obj  /out:cmTC_cc420.exe /implib:cmTC_cc420.lib /pdb:cmTC_cc420.pdb /version:0.0 /machine:x64  /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 /fo CMakeFiles\cmTC_cc420.dir/manifest.res CMakeFiles\cmTC_cc420.dir/manifest.rc" failed (exit code 0) with the following output:
    系统找不到指定的文件。
    ninja: build stopped: subcommand failed.
   
   

  

  CMake will not be able to correctly generate this project.                D:/Tools/Visual Studio/2022/Pro/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.21/Modules/CMakeTestCCompiler.cmake        69        

一些废话:
大概4月前做好了clion下vs和MinGW的配置,并在4个月内多次正常编译运行程序。已知最近一次正常使用是在7月23日,再之后就是8月25日早晨打开过一次,但没有编译运行程序、也没有注意到当时是否有报错(应该是没有报错,有的话应该会注意到)。最后就是刚才,晚上8点左右,发现异常——vs2022/2019 64位/32位全部不能用了!只剩MinGW还好好的。

如果8月25日早晨还是正常的话,那从早晨到晚上我只进行了在腾讯会议上网课、以及浏览网页等无关活动,为什么会出现问题呢。
如果早晨是我没发现报错,那从7月23日至今,我能想到的会唯二也许有影响的活动包括:安装IDEA并配置java环境,安装WebStorm并配置Apache。没了。
尝试阅读报错提示,但没有找到报错原因。
做过的尝试:百度,重启clion,重启系统,检查clion设置,直接打开vs……除了发现vs中的错误提示略有不同外毫无进展
或许重新安装一下vs就能解决问题,如果之后还是没有发现原因的话我会尝试重装的。但如果重装解决了问题,我还是对这个问题产生的原因持有大大的疑问,究竟咋回事呢?
求坛友们指点迷津!!!

最佳答案

查看完整内容

这个问题前几天我正好遇到过类似的。 建议打开 VS Installer 安装一下 SDK。我的报错也是无法找到文件,后来发现是 SDK 缺失造成。 如果不放心可以按我图上的安装。 此外,Clion 配置如下: 注意这个选默认。

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

hui-shao 发表于 2022-8-25 21:28
这个问题前几天我正好遇到过类似的。
建议打开 VS Installer 安装一下 SDK。我的报错也是无法找到文件,后来发现是 SDK 缺失造成。
如果不放心可以按我图上的安装。



此外,Clion 配置如下:



注意这个选默认。

freelive 发表于 2022-8-26 17:17
hui-shao 发表于 2022-8-26 17:41
补充下,不确定是否只是缺失了SDK ,可能得把我图上的都装上
 楼主| 电竞教父肖巴金 发表于 2022-8-27 19:02
hui-shao 发表于 2022-8-26 17:39
这个问题前几天我正好遇到过类似的。
建议打开 VS Installer 安装一下 SDK。我的报错也是无法找到文件,后 ...

谢谢,虽然我的报错不是这个原因,但是听你说的打开vs installer之后就发现问题了,它压根没检索到我安装在D盘的vs。
检索不到是因为不久前把下载缓存删了;CMake报错大概是因为检索不到吧。
总之算是受到启发并解决问题了。
快速回复 收藏帖子 返回列表 搜索

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2024-9-23 17:15

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表