The C compiler cl.exe is not able to compile a simple test program on clion

74 Views Asked by At

I am trying to add the Visualstudio tool chain on clion, but it seems that Cmake has encountered some problems. The detailed error report is as follows

-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - broken
CMake Error at S:/Clion/CLion 2023.3.4/bin/cmake/win/x64/share/cmake-3.27/Modules/CMakeTestCCompiler.cmake:67 (message):
  The C compiler

    "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe"

  is not able to compile a simple test program.

I have tried a few ways that I could find to fix the problem such as,

  • adding `set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY),
  • add_compile_options(-DCMAKE_C_COMPILER_FORCED=ON)before the project(Motion_control)`.

They did not work. Hope someone can answer my question, thank you very much.

0

There are 0 best solutions below