vs2022编译cmake项目时报错,显示找不到文件。最开始时以为是安装目录存在空格导致的,重新安装并更改后确实成功编译文件。但半天后错误重新出现,之后重新安装vs并清空注册表能纠正错误,但错误依旧会在不定时间出现。请操作尽可能的详细或者远程协助。
错误截图

错误信息:
CMake Error at C:/vs/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.27/Modules/CMakeTestCCompiler.cmake:67 (message):
The C compiler
"C:/vs/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe"
is not able to compile a simple test program.
It fails with the following output:
Change Dir: 'C:/Users/15294/source/repos/CMakeProject4/out/build/x64-debug/CMakeFiles/CMakeScratch/TryCompile-pwmpgl'
Run Build Command(s): c:\vs\common7\ide\commonextensions\microsoft\cmake\Ninja\ninja.exe -v cmTC_c31af
[1/2] C:\vs\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64\cl.exe /nologo /DWIN32 /D_WINDOWS /W3 /MDd /Ob0 /Od /RTC1 -Zi /showIncludes /FoCMakeFiles\cmTC_c31af.dir\testCCompiler.c.obj /FdCMakeFiles\cmTC_c31af.dir\ /FS -c C:\Users\15294\source\repos\CMakeProject4\out\build\x64-debug\CMakeFiles\CMakeScratch\TryCompile-pwmpgl\testCCompiler.c
[2/2] cmd.exe /C "cd . && C:\vs\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_c31af.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\vs\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_c31af.dir\testCCompiler.c.obj /out:cmTC_c31af.exe /implib:cmTC_c31af.lib /pdb:cmTC_c31af.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 ."
FAILED: cmTC_c31af.exe
cmd.exe /C "cd . && C:\vs\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe -E vs_link_exe --intdir=CMakeFiles\cmTC_c31af.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- C:\vs\VC\Tools\MSVC\14.38.33130\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_c31af.dir\testCCompiler.c.obj /out:cmTC_c31af.exe /implib:cmTC_c31af.lib /pdb:cmTC_c31af.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_c31af.dir/manifest.res CMakeFiles\cmTC_c31af.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. C:/vs/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.27/Modules/CMakeTestCCompiler.cmake 67