can't run C program

已回答

hello, I'm new to CLion, whenever I open a new C project I get the following message:

"CMake Error at E:/JetBrains/CLion 2020.2/bin/cmake/win/share/cmake-3.17/Modules/CMakeTestCCompiler.cmake:60 (message):
The C compiler

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

is not able to compile a simple test program.

It fails with the following output:

Change Dir: E:/untitled1/cmake-build-default/CMakeFiles/CMakeTmp

Run Build Command(s):nmake /nologo cmTC_6b244\fast && "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX86\x86\nmake.exe" -f CMakeFiles\cmTC_6b244.dir\build.make /nologo -L CMakeFiles\cmTC_6b244.dir\build
Building C object CMakeFiles/cmTC_6b244.dir/testCCompiler.c.obj
"C:\PROGRA~2\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\cl.exe" @C:\Users\user\AppData\Local\Temp\nm2BC1.tmp
testCCompiler.c
Linking C executable cmTC_6b244.exe
"E:\JetBrains\CLion 2020.2\bin\cmake\win\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\cmTC_6b244.dir --rc=rc --mt=CMAKE_MT-NOTFOUND --manifests -- "C:\PROGRA~2\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\Hostx86\x86\link.exe" /nologo @CMakeFiles\cmTC_6b244.dir\objects1.rsp @C:\Users\user\AppData\Local\Temp\nm2C01.tmp
RC Pass 1: command "rc /fo CMakeFiles\cmTC_6b244.dir/manifest.res CMakeFiles\cmTC_6b244.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specifiedNMAKE : fatal error U1077: '"E:\JetBrains\CLion 2020.2\bin\cmake\win\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.23.28105\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.

 

CMake will not be able to correctly generate this project."

 

 

I have no idea how to fix this. Could anyone please help?

I don't really know what this error means.

0

Hello!

RC Pass 1: command "rc /fo CMakeFiles\cmTC_6b244.dir/manifest.res CMakeFiles\cmTC_6b244.dir/manifest.rc" failed (exit code 0) with the following output:
The system cannot find the file specified

Do you have several rc.exe? Please try adding the path to rc.exe to your system path: Control Panel ⇒ (Optional) System and Security ⇒ System ⇒ Advanced System Settings ⇒ Advanced tab ⇒ Environment Variables ⇒ System Variables ⇒ Select variable named "PATH" ⇒ Edit ⇒ Add the necessary path to the existing PATH entry.

0
Avatar
Permanently deleted user

what is the necessary path? I don't really know what "rc.exe" is.

0

It's not a CLion-related question. Please see this thread, for example - https://gitlab.kitware.com/cmake/cmake/-/issues/19054:

Be sure to run in an environment in which where rc and where mt both find the tools. In the VS 2015 installer be sure relevant components are selected for Windows Desktop development with C++.

In my case rc.exe and mt.exe are located in subfolders of C:\Program Files (x86)\Windows Kits.

0

请先登录再写评论。