其他分享
首页 > 其他分享> > Clion配置MinGW运行环境时报错

Clion配置MinGW运行环境时报错

作者:互联网

Clion配置MinGW运行环境时报错

MinGW配置环境
在这里插入图片描述

-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: E:/MinGw/mingw64/bin/gcc.exe
-- Check for working C compiler: E:/MinGw/mingw64/bin/gcc.exe -- broken
CMake Error at E:/Programming Software/Clion/CLion 2019/bin/cmake/win/share/cmake-3.15/Modules/CMakeTestCCompiler.cmake:60 (message):
  The C compiler

    "E:/MinGw/mingw64/bin/gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: E:/Programming Software/浠g爜/C++绋嬪簭璁捐/Clion椤圭洰/HelloWorld/cmake-build-debug/CMakeFiles/CMakeTmp
    
    Run Build Command(s):E:/MinGw/mingw64/bin/mingw32-make.exe cmTC_514c4/fast && E:/MinGw/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_514c4.dir\build.make CMakeFiles/cmTC_514c4.dir/build
    mingw32-make.exe[1]: Entering directory 'E:/Programming Software/浠g爜/C++绋嬪簭璁捐/Clion椤圭洰/HelloWorld/cmake-build-debug/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_514c4.dir/testCCompiler.c.obj
    E:\MinGw\mingw64\bin\gcc.exe    -o CMakeFiles\cmTC_514c4.dir\testCCompiler.c.obj   -c "E:\Programming Software\娴狅絿鐖淺C++缁嬪绨拋鎹愵吀\Clion妞ゅ湱娲癨HelloWorld\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c"
    gcc.exe: error: E:\Programming Software\娴狅絿鐖淺C++缁嬪绨拋鎹愵吀\Clion妞ゅ湱娲癨HelloWorld\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
    gcc.exe: fatal error: no input files
    compilation terminated.
    mingw32-make.exe[1]: *** [CMakeFiles\cmTC_514c4.dir\build.make:65: CMakeFiles/cmTC_514c4.dir/testCCompiler.c.obj] Error 1
    mingw32-make.exe[1]: Leaving directory 'E:/Programming Software/浠g爜/C++绋嬪簭璁捐/Clion椤圭洰/HelloWorld/cmake-build-debug/CMakeFiles/CMakeTmp'
    mingw32-make.exe: *** [Makefile:120: cmTC_514c4/fast] Error 2
    
    
  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


-- Configuring incomplete, errors occurred!
See also "E:/Programming Software/浠g爜/C++绋嬪簭璁捐/Clion椤圭洰/HelloWorld/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "E:/Programming Software/浠g爜/C++绋嬪簭璁捐/Clion椤圭洰/HelloWorld/cmake-build-debug/CMakeFiles/CMakeError.log".

在这里插入图片描述

解决方法:

由于我的项目保存路径有中文如下所示:
E:/Programming Software/浠g爜/C++绋嬪簭璁捐/Clion椤圭洰/HelloWorld/cmake-build-debug/CMakeFiles/CMakeOutput.log".
See also "E:/Programming Software/浠g爜/C++绋嬪簭璁捐/Clion椤圭洰/HelloWorld/cmake-build-debug/CMakeFiles/CMakeError.log".
然而MinGW不允许输出路径有中文,所以只需要将项目路径更改,去掉中文就行,下面是我更改后的路径
E:\Programming Software\Clion\C++\HelloWorld

在这里插入图片描述
如果有解决你的问题希望收藏一下,顺便点个赞!!!

标签:exe,CMakeFiles,时报,Programming,MinGW,build,cmake,Clion
来源: https://blog.csdn.net/Y94639997/article/details/106683848