C语言 代码块找不到我的编译器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22309491/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 10:51:51  来源:igfitidea点击:

codeblocks can't find my compiler

cgcccodeblocks

提问by lbomb22

OK, so I downloaded Codeblocks and I already have a cygwin terminal on my computer that I regularly use to compile and run C programs, but when I try to build a program in CodeBlocks, it gives me an error:

好的,所以我下载了 Codeblocks 并且我的计算机上已经有一个 cygwin 终端,我经常用它来编译和运行 C 程序,但是当我尝试在 CodeBlocks 中构建程序时,它给了我一个错误:

The compiler's setup (GNU GCC Compiler) is invalid, so Code::Blocks cannot find/run the compiler.

The compiler's setup (GNU GCC Compiler) is invalid, so Code::Blocks cannot find/run the compiler.

I don't know why it can't find my compiler or why it's looking for GNU GCC compiler when I have Cygwin GCC as the default compiler.

当我将 Cygwin GCC 作为默认编译器时,我不知道为什么它找不到我的编译器,或者为什么它要寻找 GNU GCC 编译器。

回答by SilverSurfer

I faced the same problem. I have fixed out by going to Setting-> Compiler-> Global Compiler Settings-> Toolchain Execuatables (tab). There, click on Program Filesand then rename C compilerto gcc.exeand C++ compilerto g++.exe.

我遇到了同样的问题。我已经解决了Setting-> Compiler-> Global Compiler Settings-> Toolchain Execuatables (tab)。在那里,点击Program Files,然后重命名C compilergcc.exeC++ compilerg++.exe

回答by Patrice Andala

I know this is an old question but let me see if I can help. First of all, on the download page make sure you downloaded codeblocks-13.12mingw-setup.exe and NOT codeblocks-13.12-setup.exe. Of course the version numbers may change but pay attention to the name. Then after installing codeblocks, go to Settings->Compiler->Toolchain executables. From here, change the C compiler to gcc.exe and C++ compiler to g++.exe. Hope this helps anyone else going through this problem :-)

我知道这是一个老问题,但让我看看我是否可以提供帮助。首先,在下载页面确保您下载的是 codeblocks-13.12mingw-setup.exe 而不是 codeblocks-13.12-setup.exe。当然版本号可能会改变,但请注意名称。然后在安装代码块后,转到设置->编译器->工具链可执行文件。从这里开始,将 C 编译器更改为 gcc.exe,将 C++ 编译器更改为 g++.exe。希望这可以帮助其他人解决这个问题:-)

回答by learner

I think you have not set your compiler.You have to choose the compiler you want to use. For this purpose click 'Settings'-> 'Compiler and Debugger' and select 'Other Settings' in the drop-down field.Choose your own compiler and save it.Now rerun your program.

我想你还没有设置你的编译器。你必须选择你想使用的编译器。为此,单击“设置”->“编译器和调试器”并在下拉字段中选择“其他设置”。选择您自己的编译器并保存它。现在重新运行您的程序。

回答by γηρ?σκω δ' αε? πολλ? διδασκ?με

Go to:

去:

Settings -> Compiler... -> Toolchain executables(Tab)

In the compiler's installation directorychoose the folder where your compiler is.

编译器的安装目录中选择编译器所在的文件夹。

valter

瓦尔特

回答by γηρ?σκω δ' αε? πολλ? διδασκ?με

i have just solved the problem.

我刚刚解决了这个问题。

it happening because the path of you compilers is not correct in settings.code blocks downloads and installs compilers for you. you don not need to it manually. thus in some cases it takes wrong path of location of compilers.

发生这种情况是因为 settings.code 中的编译器路径不正确,会阻止下载并为您安装编译器。你不需要手动。因此,在某些情况下,它采用错误的编译器位置路径。

now heres the solution:- 1. right click on code blocks and go to properties and copy its location,and open command promt tpye cd and past the location. if you know what this all about then just go to file where your code block is install.

现在是解决方案:- 1. 右键单击​​代码块并转到属性并复制其位置,然后打开命令提示符 tpye cd 并通过该位置。如果您知道这一切,那么只需转到安装代码块的文件即可。

2.you will found MinGW directory or folder.

2.您将找到MinGW目录或文件夹。

3.right click on the folder, copy its location

3.右键单击文件夹,复制其位置

4.open code blocks,go to settings which u will find in menu.

4.打开代码块,进入你会在菜单中找到的设置。

5.go to compilers and then go to toolchain executable

5.转到编译器,然后转到工具链可执行文件

6.u will see compiler's installation directory past our location in white box below that.

6.你会在下面的白框中看到编译器的安装目录超过我们的位置。

  1. CLICK OK
  1. 单击确定

you have solved ur problem. if this dose not work then try reinstalling

你已经解决了你的问题。如果此剂量不起作用,请尝试重新安装

回答by Vinod

I have just solved this problem.

我刚刚解决了这个问题。

In addition to above mentioned solutions , you can follow the path in "Setting -> Compiler -> Global Compiler Settings -> Toolchain Execuatables (tab)" and check the path for Compiler's installation directory. If it is blank, then click on "Auto Detect" tab. It will update the installation directory.

除了上面提到的解决方案,您可以按照“设置 -> 编译器 -> 全局编译器设置 -> 工具链可执行文件(选项卡)”中的路径检查编译器安装目录的路径。如果为空白,则单击“自动检测”选项卡。它将更新安装目录。

回答by Vaibhav Khamankar

I just solved the problem. Click 'Settings->Compiler and debugger->Toolchain executables'.Now in "Compiler's installation directory"click on 'Auto-detect'or browse to the path of compiler. It can be found usually at "C:\Program Files (x86)\CodeBlocks-EP\MinGW", if Codeblocks is installed in C-drive.

我刚刚解决了这个问题。单击“设置->编译器和调试器->工具链可执行文件”。现在在“编译器的安装目录”中单击“自动检测”或浏览到编译器的路径。如果 Codeblocks 安装在 C 驱动器中,它通常可以在"C:\Program Files (x86)\CodeBlocks-EP\MinGW" 找到

回答by Saif Ul Islam

I solved this problem I firstly downloaded codeblocks-17.12-setup.exe and then added MinGW directory location at Setting -> Compiler -> Global Compiler Settings -> Toolchain Execuatables (tab) -> compiler installation directory" but it did n't work then downloaded codeblocks-13.12mingw-setup.exe and did the same process again and it worked.

我解决了这个问题我首先下载了codeblocks-17.12-setup.exe,然后在设置->编译器->全局编译器设置->工具链可执行文件(选项卡)->编译器安装目录中添加了MinGW目录位置”但它不起作用然后下载了 codeblocks-13.12mingw-setup.exe 并再次执行相同的过程并且它起作用了。

回答by Arulyan Asokan

If you change the default path of codeblocks while installation, then you may be suffering from this problem.

如果您在安装时更改了代码块的默认路径,那么您可能会遇到此问题。

If you go to Settings>Global compiler settings>Toolchain executables(tab)and see the Compiler's installation directory, it may be set by default to C:\MinGWsomething like that.

如果您转到设置>全局编译器设置>工具链可执行文件(选项卡)并查看编译器的安装目录,它可能默认设置为C:\MinGW 之类的。

Just press the Auto-detectbutton and it will find the actual directory of the compiler.

只需按下自动检测按钮,它就会找到编译器的实际目录。

Click OKand you are ready to Code!

单击“确定”,您就可以开始编码了!

回答by Salama96

I think the major problem is that most of us creates a project and then applies the Compiler's configuration and waits till the project applies the configured changes.

我认为主要的问题是我们大多数人创建一个项目,然后应用编译器的配置并等待项目应用配置的更改。

Will this is TOTALLY WRONGif you created the project before configuring the Compiler , the project won't change it's Compiler , so you need to reconfigure your created project by : Right Click on the project-> Select Build Options-> Reconfigure the selected compiler to CygwinGCC.

如果您在配置 Compiler 之前创建了项目,这是否完全错误,该项目不会更改它的 Compiler,因此您需要通过以下方式重新配置您创建的项目: 右键单击项目->选择构建选项->重新配置所选编译器到 CygwinGCC