CLion啟動專案失敗的解決方法
今天用CLion開啟老師不值得專案是發生了不知名的錯誤,明明和跟著步驟走的但最終卻執行失敗。
提示資訊如下
CMake Error at E:/Clion/CLion 2017.3.4/bin/cmake/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message): The C compiler "E:/codeblocks/MinGW/bin/gcc.exe" is not able to compile a simple test program.
It fails with the following output:
Change Dir: C:/Users/admin/Desktop/鏉�/DongmenDB-master/cmake-build-debug/CMakeFiles/CMakeTmp
Run Build Command:"E:/codeblocks/MinGW/bin/mingw32-make.exe" "cmTC_9286f/fast"
E:/codeblocks/MinGW/bin/mingw32-make.exe -f CMakeFiles\cmTC_9286f.dir\build.make CMakeFiles/cmTC_9286f.dir/build
mingw32-make.exe[1]: Entering directory 'C:/Users/admin/Desktop/鏉�/DongmenDB-master/cmake-build-debug/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_9286f.dir/testCCompiler.c.obj
E:\codeblocks\MinGW\bin\gcc.exe -o CMakeFiles\cmTC_9286f.dir\testCCompiler.c.obj -c C:\Users\admin\Desktop\閺変繐DongmenDB-master\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c
gcc.exe: error: C:\Users\admin\Desktop\閺変繐DongmenDB-master\cmake-build-debug\CMakeFiles\CMakeTmp\testCCompiler.c: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
CMakeFiles\cmTC_9286f.dir\build.make:64: recipe for target 'CMakeFiles/cmTC_9286f.dir/testCCompiler.c.obj' failed
mingw32-make.exe[1]: *** [CMakeFiles/cmTC_9286f.dir/testCCompiler.c.obj] Error 1
mingw32-make.exe[1]: Leaving directory 'C:/Users/admin/Desktop/鏉�/DongmenDB-master/cmake-build-debug/CMakeFiles/CMakeTmp'
Makefile:125: recipe for target 'cmTC_9286f/fast' failed
mingw32-make.exe: *** [cmTC_9286f/fast] Error 2
CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:8 (PROJECT)
-- Configuring incomplete, errors occurred! See also "C:/Users/admin/Desktop/鏉�/DongmenDB-master/cmake-build-debug/CMakeFiles/CMakeOutput.log". See also "C:/Users/admin/Desktop/鏉�/DongmenDB-master/cmake-build-debug/CMakeFiles/CMakeError.log".
執行按鈕也是灰色的
以上大部分資訊無用,最重要的一句為
The C compiler "E:/codeblocks/MinGW/bin/gcc.exe" is not able to compile a simple test program.
還有諸如 鏉� 的亂碼
問題就在這裡了,由此想到編碼問題,像極了以前遇到過的中文匯入出現亂碼。於是查看了專案的路徑
C:\Users\admin\Desktop\雜\DongmenDB-master
解決方法
將專案檔名改為英文,即路徑中不能存在中文。
所以以後還是儘量使用英文檔名吧。