How to fix The C compiler "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe" is not able to compile a simple test program.

k_cire 15 Reputation points
2023-01-18T15:21:12.05+00:00
Erreur		CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.24/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.34.31933/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/320216482/source/repos/CMakeProject1/out/build/x64-debug/CMakeFiles/CMakeTmp
    
    Run Build Command(s):C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe cmTC_1acb3 && [1/2] Building C object CMakeFiles\cmTC_1acb3.dir\testCCompiler.c.obj
    [2/2] Linking C executable cmTC_1acb3.exe
    FAILED: cmTC_1acb3.exe 
    cmd.exe /C "cd . && "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_1acb3.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests  -- C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1434~1.319\bin\Hostx64\x64\link.exe /nologo CMakeFiles\cmTC_1acb3.dir\testCCompiler.c.obj  /out:cmTC_1acb3.exe /implib:cmTC_1acb3.lib /pdb:cmTC_1acb3.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_1acb3.dir/manifest.res CMakeFiles\cmTC_1acb3.dir/manifest.rc" failed (exit code 0) with the following output:
    Le fichier spécifié est introuvable
    ninja: build stopped: subcommand failed.

  CMake will not be able to correctly generate this project.		C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.24/Modules/CMakeTestCCompiler.cmake	69	

Community Center Not monitored
{count} vote

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,436 Reputation points Microsoft External Staff
    2023-01-19T02:44:28.9666667+00:00

    Hello @k_cire,

    Welcome to Microsoft Q&A forum.

    Could you please share us the detailed steps to reproduce this issue and check further?

    You are using CMake in Visual Studio right? Have you checked this document: CMake projects in Visual Studio, and installed related workloads and components? Please follow the document to create and build your simple test program. If the issue appears in a newly created project, please feel free to let us know.

    Sincerely,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.