我是这个 IDE 的新手,在 Windows 上编程,我已经安装了 MinGW 并添加到环境路径,一切正常,我可以从“cmd”编译和执行代码,但是当我运行 CLion 时出现这个错误:
-- The C compiler identification is GNU 6.3.0
-- The CXX compiler identification is GNU 6.3.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files/JetBrains/CLion 2017.3.1/bin/cmake/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test program.
失败,输出如下:
Change Dir: C:/Users/noName/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp
Run Build Command:"C:/MinGW/bin/mingw32-make.exe" "cmTC_2e43b/fast"
C:/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_2e43b.dir\build.make CMakeFiles/cmTC_2e43b.dir/build
mingw32-make.exe1: Entering directory
'C:/Users/noName/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'CMakeFiles\cmTC_2e43b.dir\build.make:64: recipe for target
'CMakeFiles/cmTC_2e43b.dir/testCCompiler.c.obj' failedprocess_begin:
CreateProcess(C:\Users\noName\AppData\Local\Temp\make2428-1.bat, C:\Users\noName\AppData\Local\Temp\make2428-1.bat, ...) failed.make (e=2): El sistema no puede encontrar el archivo especificado.
mingw32-make.exe1: *** [CMakeFiles/cmTC_2e43b.dir/testCCompiler.c.obj] Error 2
mingw32-make.exe1: Leaving directory
'C:/Users/noName/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeTmp'Makefile:125: recipe for target 'cmTC_2e43b/fast' failed
mingw32-make.exe: *** [cmTC_2e43b/fast] Error 2
CMake will not be able to correctly generate this project. Call Stack (most recent call first):
CMakeLists.txt:1 (project)-- Configuring incomplete, errors occurred!
See also "C:/Users/noName/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/noName/AppData/Local/Temp/cmake_check_environment/_build/CMakeFiles/CMakeError.log".Error code: 1
这是照片。我认为这是 CMake(?) 的错误
最佳答案
你的 windows 64 位,你不能在 windows 64 中编写 gcc.exe
和 g++.exe
。你应该尝试安装 mingw-w64.
你可以从here下载这个并安装它。
之后你应该进入 CLion setting -> build,Execution,deployment -> Toolchains
和这样的配置picture
对于安装程序 mingw-w64
,您应该安装程序默认选项。
关于gcc - CLion + MinGW 测试 CMake 运行完成但出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48241152/