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。

商务合作@群主,谢谢!

  • 3
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值