C++-codeblocks安装

2020-02-14------------恢复内容开始------------

"Test_leetcode - Debug": The compiler's setup (GNU GCC Compiler) is invalid, so Code::Blocks cannot find/run the compiler.
Probably the toolchain path within the compiler options is not setup correctly?! (Do you have a compiler installed?)
Goto "Settings->Compiler...->Global compiler settings->GNU GCC Compiler->Toolchain executables" and fix the compiler's setup.
Skipping...
Nothing to be done (all items are up-to-date).

Target uses an invalid compiler; run aborted
Target uses an invalid compiler; run aborted
Target uses an invalid compiler; run aborted
Target uses an invalid compiler; run aborted
Target uses an invalid compiler; run aborted

翻译一下

编译器的设置(GNU GCC编译器)无效,因此Code::Blocks无法找到/运行编译器。
可能编译器选项中的工具链路径设置不正确?(是否安装了编译器?)
转到“设置->编译器…->全局编译器设置->GNU GCC编译器->工具链可执行文件”,并修复编译器的设置。
跳过。
无事可做(所有项目都是最新的)。

目标使用了无效的编译器;运行被中止
目标使用了无效的编译器;运行被中止
目标使用了无效的编译器;运行被中止
目标使用了无效的编译器;运行被中止
目标使用了无效的编译器;运行被中止

不清楚原因:百度一下

百度下载了一个Code Blocks,安装完发现找不到GCC编译器,百度一下,发现原来是下载的是不带编译器的,郁闷,于是按照别人说的到它的官网下载带编译器版本的,也就是有MinGW字样的。可怜我乌龟一样的网速,90多M的东西下了半个多小时,结果安装好后还是跟之前一样。百思不得其解,百度上搜索也找不到满意答案,都说只要下载有MinGW的就行了,严重怀疑是自己没安装好,但是在官网上下载的应该没问题才对啊。

然后我想到一个问题,那种不带编译器的,人家是怎么用的,继续百度,大致是说自己下载一个编译器,设置到系统环境变量中就行了,然后人家推荐的就是MinGW。这时我灵机一动,进入Code Blocks的安装目录下一看,确实是有MinGW这个目录的。然后我想直接把这个目录设到环境变量中应该就没问题了。

然而试了下并没有什么卵用,不过这时候控制台的一行信息吸引了我的注意:Goto "Settings->Compiler...->Global compiler settings->GNU GCC Compiler->Toolchain executables" and fix the compiler's setup. 
Skipping... 
抱着试一试的心态,根据上面说的点到Toolchain executables,然后发现Compiler’s installation directory那里的路径居然是C:\MinGW,简直气死本大爷,果断改成Code Blocks里面的MinGW路径,然后问题解决了。

哎,安装个IDE都这么蛋疼,不过也怪自己太傻,习惯了傻瓜式的一键安装,稍微出点问题就懵圈。

百度解释缺少GCC编译器,推荐编译器MinGW,MinGW路径要和codeblocks中编译器的安装位置一致

我出现错误也是缺少编译器,我选择从官网下载带MinGW字样的编译器,我通过"Settings->Compiler...->Global compiler settings->GNU GCC Compiler->Toolchain executables"查看安装路径和codeblocks软件实际的路径一致

最后推荐官方安装codeblocks方法

自带mingw的codeblocks下载及安装教程

  • 小编也不多说了,你能搜到这篇经验肯定就代表你已经有了初步了解codeblocks了,不需要我做介绍了。这里放两张codeblocks界面图片。多的不说了,接下来直接上教程。或者codeblocks提示Target uses an invalid compiler; run aborted。
自带mingw的codeblocks下载及安装教程
 
自带mingw的codeblocks下载及安装教程
 

工具/原料

 
  • 能上网的电脑
  • 随便一个浏览器

方法

 
  1.  

    方法一是到官网下载含有mingw的codeblocks。这个下载下来直接安装不需要在配置什么。www.codeblocks.org或者download codeblocks

    自带mingw的codeblocks下载及安装教程
  2.  

    进入官网之后,全是英文不要紧,直接找到关键词download。点击进去,之后还会弹出一个让你选择下载的codeblocks的方式。也就是第二图中的那几个选项。

    自带mingw的codeblocks下载及安装教程
    自带mingw的codeblocks下载及安装教程
  3.  

    如图,Download the binary release这个是最简单的下载以及安装方式,也就是我们要下载的方式。

    Download the source code

    这个是指下载codeblocks的源码。不用管

    Retrieve source code from SVN

    这个是指从SVN获取源代码,也不用管,我们直接点击Download the source code

    自带mingw的codeblocks下载及安装教程
  4.  

    根据不同的系统选择不同的版本下载。这里我们找到windows版本。

    自带mingw的codeblocks下载及安装教程
    自带mingw的codeblocks下载及安装教程
  5.  

    不同的名字对应不同的版本,codeblocks-16.01-setup.exe表示直接下载codeblocks这个没有集成mingw。而在下面的codeblocks-16.01mingw-setup.exe这个的codeblocks已经带有了mingw,直接下载这个就可以了。

    自带mingw的codeblocks下载及安装教程
  6.  

    下载好以后直接双击安装就行了。

    自带mingw的codeblocks下载及安装教程
    自带mingw的codeblocks下载及安装教程
  7.  

    安装好以后打开软件,如果软件还是提示没有GCC或者在运行软件的时候提示Target uses an invalid compiler; run aborted,那就在codeblocks——settings——complier

    自带mingw的codeblocks下载及安装教程
    自带mingw的codeblocks下载及安装教程
  8.  

    在complier里面点击图示的位置,可以点击Auto-detect可以自动探测mingw 的位置,或者可以点击“...”自己自定义mingw的路径。

    自带mingw的codeblocks下载及安装教程
    自带mingw的codeblocks下载及安装教程

------------恢复内容结束------------

猜你喜欢

转载自www.cnblogs.com/xiaoming521/p/12309190.html