Window10上安裝和配置CLion

1. 首先,下載安裝CLion

 

去JB公司官網下載CLion,
https://www.jetbrains.com/clion/download/#section=windows

下載CLion

 

如果需要破解的話請移步http://idea.lanyus.com/,建議有能力的同學使用正版。
安裝的話,隨意即可。

2. 下載安裝MinGW

這裏提供兩種配置方法,感謝博客主呆呆小六的指點修正。

2.1 方法一:下載MinGW壓縮包

(1)下載MinGW
這裏必須注意的是下載壓縮包,不要下載離線安裝的版本,不然你會裝到猴年馬月,而且安裝難度較大。
打開下載地址:MinGW 進入下載頁面

MinGW

 

注意:不要手賤點綠色按鈕去下載!!!
往下拉,一直拉到下面的界面,然後就可以下載壓縮包了。

MinGW壓縮包

 

當然,如果嫌棄這個速度太慢的話,本人也是貼心的準備了網盤
下載鏈接:https://pan.baidu.com/s/1zd5hgyvXJdBxRrj6aq4JKg
密碼:obb8
下載了以後必須是解壓啊,然後開始配置CLion。

(2)配置CLion
打開CLion,左上角File-Settings-Build-Toolchains,然後點擊 +

settings

 

toolchains

Environment選擇MinGW,然後填入剛剛解壓的MinGW64的路徑(這是我的路徑):

C:\Users\71022\Documents\mingw64

image.png

然後CLion會自動幫你填上所有你該填的東西,點擊OK,等調試的小蟲子變綠就可以了。

image.png

當然,也會出現無法檢測成功的情況,這時候就需要手動填寫啦。
CMake一般會自動選擇。
Make填入路徑:

C:\Users\71022\Documents\mingw64\bin\mingw32-make.exe

C Compiler填入路徑:

C:\Users\71022\Documents\mingw64\bin\gcc.exe

C++ Compiler填入路徑:

C:\Users\71022\Documents\mingw64\bin\g++.exe

Debugger一般會自己填入,如果沒有可以手動填:

C:\Users\71022\Documents\mingw64\bin\gdb.exe

然後OK,等一段時間就可以了。
調試效果如下:

CLion調試

2.2 方法二:藉助DEV C++

(1)下載安裝DEV C++
https://sourceforge.net/projects/orwelldevcpp/

下載DEV C++

 

安裝默認路徑即可,注意,選擇full安裝!!!

(2)配置CLion
同樣地,打開CLion,左上角File-Settings-Build-Toolchains,然後點擊 +

settings

toolchains

Environment選擇MinGW,然後填入剛剛安裝的dev cpp的MinGW64的路徑:

C:\Program Files (x86)\Dev-Cpp\MinGW64

CMake一般會自動選擇。
Make填入路徑:

C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\mingw32-make.exe

C Compiler填入路徑:

C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\gcc.exe

C++ Compiler填入路徑:

C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\g++.exe

Debugger一般會自己填入,如果沒有可以手動填:

C:\Program Files (x86)\Dev-Cpp\MinGW64\bin\gdb.exe

然後OK,等一段時間就可以了。

配置詳情

看到小蟲子綠了,就說明配置好了,趕緊試試調試吧!

說下我遇到的問題:Test CMake run finished with error more……

-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: E:/Software/DevelopmentTool/mingw64鍘嬬緝鍖�/x86_64/mingw64/bin/gcc.exe
-- Check for working C compiler: E:/Software/DevelopmentTool/mingw64鍘嬬緝鍖�/x86_64/mingw64/bin/gcc.exe -- broken
CMake Error at E:/Software/DevelopmentTool/Clion/CLion 2018.3.4/bin/cmake/win/share/cmake-3.13/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "E:/Software/DevelopmentTool/mingw64鍘嬬緝鍖�/x86_64/mingw64/bin/gcc.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: C:/Users/hp/AppData/Local/Temp/cmake_check_environment/_build7883259474733930842/CMakeFiles/CMakeTmp
    
    Run Build Command:"E:/Software/DevelopmentTool/mingw64鍘嬬緝鍖�/x86_64/mingw64/bin/mingw32-make.exe" "cmTC_b6e77/fast"
    E:/Software/DevelopmentTool/mingw64鍘嬬緝鍖�/x86_64/mingw64/bin/mingw32-make.exe -f CMakeFiles\cmTC_b6e77.dir\build.make CMakeFiles/cmTC_b6e77.dir/build
    mingw32-make.exe[1]: Entering directory 'C:/Users/hp/AppData/Local/Temp/cmake_check_environment/_build7883259474733930842/CMakeFiles/CMakeTmp'
    Building C object CMakeFiles/cmTC_b6e77.dir/testCCompiler.c.obj
    E:\Software\DevelopmentTool\mingw64閸樺緙夐崠鍖紉86_64\mingw64\bin\gcc.exe    -o CMakeFiles\cmTC_b6e77.dir\testCCompiler.c.obj   -c C:\Users\hp\AppData\Local\Temp\cmake_check_environment\_build7883259474733930842\CMakeFiles\CMakeTmp\testCCompiler.c
    process_begin: CreateProcess(NULL, E:\Software\DevelopmentTool\mingw64閸樺緙夐崠鍖紉86_64\mingw64\bin\gcc.exe -o CMakeFiles\cmTC_b6e77.dir\testCCompiler.c.obj -c C:\Users\hp\AppData\Local\Temp\cmake_check_environment\_build7883259474733930842\CMakeFiles\CMakeTmp\testCCompiler.c, ...) failed.
    make (e=2): 緋葷粺鎵句笉鍒版寚瀹氱殑鏂囦歡銆�
    mingw32-make.exe[1]: *** [CMakeFiles\cmTC_b6e77.dir\build.make:65: CMakeFiles/cmTC_b6e77.dir/testCCompiler.c.obj] Error 2
    mingw32-make.exe[1]: Leaving directory 'C:/Users/hp/AppData/Local/Temp/cmake_check_environment/_build7883259474733930842/CMakeFiles/CMakeTmp'
    mingw32-make.exe: *** [Makefile:120: cmTC_b6e77/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/hp/AppData/Local/Temp/cmake_check_environment/_build7883259474733930842/CMakeFiles/CMakeOutput.log".
See also "C:/Users/hp/AppData/Local/Temp/cmake_check_environment/_build7883259474733930842/CMakeFiles/CMakeError.log".

Error code: 1

原因:文件路徑有中文或者是無法識別的字符導致

解決辦法:修改mingw64安裝的文件名即可。

你是技術宅麼?那就加入我們吧!點擊下方鏈接 或 掃描二維碼 即可。

歡迎加入 CSDN技術交流羣:(點擊即可加羣)QQ羣:681223095。

商務合作@羣主,謝謝!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章