参考:1 配置C++和基础
报错时工具版本Cmake工具版本为3.18.0免安装ZIP版本mingw为8.1.0免安装ZIP版本Path环境配置正确 报错问题
新建CMakeLists.txt文件编译时候发现报错
报错的提示为:出现乱码Error running link command: 绯荤粺鎵句笉鍒版寚瀹氱殑鏂囦欢銆?mingw32-make.exe[1]:
[cmake] CMake Error at D:/Cmake/share/cmake-3.18/Modules/CMakeTestCCompiler.cmake:66 (message): [cmake] The C compiler [cmake] [cmake] "D:/MinGW/bin/x86_64-w64-mingw32-gcc.exe" [cmake] [cmake] is not able to compile a simple test program. [cmake] [cmake] It fails with the following output: [cmake] [cmake] Change Dir: D:/Workspace/My/build/CMakeFiles/CMakeTmp [cmake] [cmake] Run Build Command(s):D:/MinGW/bin/mingw32-make.exe cmTC_90878/fast && D:/MinGW/bin/mingw32-make.exe -f CMakeFilescmTC_90878.dirbuild.make CMakeFiles/cmTC_90878.dir/build [cmake] mingw32-make.exe[1]: Entering directory 'D:/Workspace/My/build/CMakeFiles/CMakeTmp' [cmake] Building C object CMakeFiles/cmTC_90878.dir/testCCompiler.c.obj [cmake] D:MinGWbinx86_64-w64-mingw32-gcc.exe -o CMakeFilescmTC_90878.dirtestCCompiler.c.obj -c D:WorkspaceMybuildCMakeFilesCMakeTmptestCCompiler.c [cmake] linking C executable cmTC_90878.exe [cmake] D:Cmakebincmake.exe -E cmake_link_script CMakeFilescmTC_90878.dirlink.txt --verbose=1 [cmake] D:Cmakebincmake.exe -E rm -f CMakeFilescmTC_90878.dir/objects.a [cmake] CMAKE_AR-NOTFOUND cr CMakeFilescmTC_90878.dir/objects.a @CMakeFilescmTC_90878.dirobjects1.rsp [cmake] Error running link command: 绯荤粺鎵句笉鍒版寚瀹氱殑鏂囦欢銆?mingw32-make.exe[1]: *** [CMakeFilescmTC_90878.dirbuild.make:108: cmTC_90878.exe] Error 2 [cmake] mingw32-make.exe[1]: Leaving directory 'D:/Workspace/My/build/CMakeFiles/CMakeTmp' [cmake] mingw32-make.exe: *** [Makefile:140: cmTC_90878/fast] Error 2相关解决帖子:
Window10上安装和配置CLion,原文提示是路径下存在中文名。但是本人安装路径不存在中文名称。
解决方法选择高版本的CMake工具,此时选择3.22.1免安装ZIP版本
附安装文件连接附mingw8.1.0和cmake3.22.1免安装文件
链接:https://pan.baidu.com/s/1UpQuBDlLzhHRb-LpSqB5Mw
提取码:hxvn



