CLion:错误:C编译器"C:/MinGW/bin/gcc.exe"已被删除.无法编译简单的测试程序 [英] CLion: Error:The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test program

查看:884
本文介绍了CLion:错误:C编译器"C:/MinGW/bin/gcc.exe"已被删除.无法编译简单的测试程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用MinGW在Windows 7上运行CLion,但是由于某些原因CMake无法编译简单的测试程序,但是当我创建一个简单的hello world文件时,当我直接调用编译器而不是CMake时,它的编译就很好

I'm trying to run CLion on windows 7 with MinGW but for some reason CMake can't compile the simple test program but when I create a simple hello world file it compiles just fine when I call the compiler directly instead of CMake.

我已经尝试了多个版本的MinGW,但对错误没有影响.我什至卸载了AV来查看是否是问题所在,但再次没有任何改变.

I already tried several versions of MinGW but it makes no difference on the error. I even uninstalled my AV to see if that was the problem but once again nothing changed at all.

我的路径中有MinGW,也有CMake.起初,我认为TEMP文件夹的权限可能有问题,但它们似乎都不错.我也是管理员帐户.

I have MinGW in my path and CMake as well. At first I thought it maybe was a problem with permissions on the TEMP folder but they all seem fine. I'm on an administrator account as well.

这是我在CLion中遇到的错误:

This is the error I get in CLion:

Error:The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/Jim/.clion10/system/cmake/generated/4cb6a70c/4cb6a70c/__default__/CMakeFiles/CMakeTmp
Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTryCompileExec141319549/fast"
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTryCompileExec141319549.dir\build.make CMakeFiles/cmTryCompileExec141319549.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/Jim/.clion10/system/cmake/generated/4cb6a70c/4cb6a70c/__default__/CMakeFiles/CMakeTmp'
"C:\Program Files (x86)\JetBrains\CLion 1.0\bin\cmake\bin\cmake.exe" -E cmake_progress_report C:\Users\Jim\.clion10\system\cmake\generated\4cb6a70c\4cb6a70c\__default__\CMakeFiles\CMakeTmp\CMakeFiles 1
CMakeFiles\cmTryCompileExec141319549.dir\build.make:56: recipe for target 'CMakeFiles/cmTryCompileExec141319549.dir/testCCompiler.c.obj' failed
process_begin: CreateProcess(C:\Users\Jim\AppData\Local\Temp\make68804-1.bat, C:\Users\Jim\AppData\Local\Temp\make68804-1.bat, ...) failed.
make (e=2): Het systeem kan het opgegeven bestand niet vinden.
mingw32-make.exe[1]: *** [CMakeFiles/cmTryCompileExec141319549.dir/testCCompiler.c.obj] Error 2
mingw32-make.exe[1]: Leaving directory 'C:/Users/Jim/.clion10/system/cmake/generated/4cb6a70c/4cb6a70c/__default__/CMakeFiles/CMakeTmp'
Makefile:117: recipe for target 'cmTryCompileExec141319549/fast' failed
mingw32-make.exe: *** [cmTryCompileExec141319549/fast] Error 2
CMake will not be able to correctly generate this project.

这是我尝试从CMD使用CMake时遇到的错误:

This is the error I get when I try to use CMake from CMD:

推荐答案

对于一个虚假的cmake项目(一个仅包含cmake_minimum_required(VERSION 2.8)add_executable(helloWorld <your hello world program>)的CMakeLists.txt),我们已经确定编译器和CLion不是问题,所以可能与make有关. 此处是日志.

With a dummy cmake project (A CMakeLists.txt with simply cmake_minimum_required(VERSION 2.8) and add_executable(helloWorld <your hello world program>).), we have established that the compiler and CLion are not the problem, so it's probably something to do with make. Here was the log.

我的猜测是您的路径中有msys.如果sh.exe在您的路径中,则表明它会会导致问题.

My guess is that you have msys in your path. If sh.exe is in your path, it is known to cause problems.

作为一种安全的替代方法,您可以决定使用 ninja 作为make的替代方法(cmake 实验性地支持它,但实际上它很好地支持了它. ). 在这里,您可以找到预构建的包(实际上,它只是一个可执行文件,您必须将其放入路径中).

As a safe alternative, you can decide to use ninja as an alternative to make (cmake supports it experimentally, but in practice it supports it pretty well). Here you can find prebuilt packages (in fact, it's just one executable you have to put in your path).

CLion中的忍者集成应该可以正常工作很好.

Ninja integration within CLion should work just fine.

这篇关于CLion:错误:C编译器"C:/MinGW/bin/gcc.exe"已被删除.无法编译简单的测试程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆