在gnc gcc编译器的配置搜索路径中找不到文件可执行文件 [英] Can't find file executable in your configured search path for gnc gcc compiler

查看:4691
本文介绍了在gnc gcc编译器的配置搜索路径中找不到文件可执行文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题是,code :: blocks错误消息告诉我它无法在 gnc gcc 编译器的搜索路径中找到文件可执行文件。虽然,我不知道这意味着什么。我还输入了一些代码:

  #include< iostream> 
使用namespace std;

int main(void){
cout<<Hello World<< endl;

返回0;
}

我无法编译它或以代码运行::块。我需要做什么?

我上线了,但我得到了一些答案,超出了我的头。在安装 Visual studio express 2013 之前,我能够使用code :: blocks。 Visual Studio 也无法正常工作。每次我试图打开它时,它都会要求我修复或卸载。所以我把它和 code :: blocks 一起删除了。现在我重新安装了 code :: blocks 我仍然无法正常工作。



编译器的这个问题正在占用我所有的时间,而且我无法练习学习编程,因为我无法让任何编译器正常工作。我需要一些帮助。

解决方案

我猜你已经安装了Code :: Blocks,但没有安装或设置GCC呢。我假设你在Windows上,根据你对Visual Studio的评论;如果您在不同的平台上,设置GCC的步骤应该相似但不完全相同。



首先,您需要下载GCC。有很多很多不同的构建;个人而言,我使用64位版本的 TDM-GCC 。这个设置可能比你想要的要复杂一点,所以你可以选择32位版本,或者只是预先配置Code :: Blocks / TDM-GCC设置这里



完成设置后,继续并启动Code :: Blocks。您不需要创建项目或编写任何代码;我们只是在这里设置或仔细检查您的设置,具体取决于您选择安装GCC的方式。



进入设置菜单,然后在侧边栏中选择全局编译器设置,然后选择工具链可执行文件选项卡。确保编译器的安装目录文本框与您安装GCC的文件夹匹配。对我来说,这是 C:\ TDM-GCC-64 。你的路径会有所不同,这是完全正确的;只要确保文本框中的路径与您安装的路径相同即可。请注意警告提示Code :: Blocks shows:该文件夹必须包含 bin 子文件夹,其中将包含所有相关的GCC可执行文件。如果您查看文本框显示的文件夹,并且那里没有 bin 子文件夹,则可能指定了错误的安装文件夹。



现在,在相同的工具链可执行文件屏幕中,查看单个程序文件并验证每个文件中显示的文件名是否正确。您需要以下变体:


  • C编译器: gcc.exe (mine shows x86_64-w64-mingw32-gcc.exe

  • C ++编译器: g ++ .exe (我的展示 x86_64-w64-mingw32-g ++。exe

  • 动态库链接器: g ++。exe (mine shows x86_64-w64-mingw32-g ++。exe

  • Linker for static libs: gcc-ar.exe (mine shows x86_64-w64-mingw32-gcc-ar.exe
  • 调试器: GDB / CDB调试器:默认

  • 资源编译器: windres.exe (我的节目 windres.exe
  • 制作节目: make.exe (我的节目 mingw32-make.exe



再次注意,所有这些文件都位于编译器安装中显示的文件夹的 bin 子文件夹中文件夹框 - 如果找不到这些文件,则可能是文件夹规格错误IED。尽管如此,如果文件名不是完美匹配的话,那还是可以的。不同的GCC版本可能有不同的前缀文件名,正如你可以从我的设置中看到的那样。



一旦完成了所有这些,请继续并点击确定。如果你愿意的话,你可以重新启动Code :: Blocks,只是为了确认即使发生崩溃也能保持更改(我有偶尔的错误,Code :: Blocks会崩溃并忘记自上次启动以来更改的任何设置)。

现在,你应该全部设定。继续尝试再次尝试一小段代码。你需要 int main(void) int main(),但其他一切看起来都不错。尝试构建并运行它,看看会发生什么。它应该成功运行。


My problem is that code::blocks error message tells me that it can't find file executable in the search path for gnc gcc compiler. Although, I don't know what that means. Also I typed out some code:

#include <iostream>
 using namespace std;

 int main(void) {
    cout <<"Hello World" <<endl;

    return 0;
 }

I can't build it or run in code::blocks. What do I need to do?

I went on line but I got some answers that are way over my head. I was able to use code::blocks once before I installed Visual studios express 2013. Visual studios didn't work right either. It kept asking me to repair or uninstall every time I tried to open it. So I deleted it along with code::blocks. Now that I re-installed code::blocks I still can't get to work right.

This problem with compilers is taking up all my time and I can't practice learning programming because I can't get any compiler to work right. I need some help, please.

解决方案

I'm guessing you've installed Code::Blocks but not installed or set up GCC yet. I'm assuming you're on Windows, based on your comments about Visual Studio; if you're on a different platform, the steps for setting up GCC should be similar but not identical.

First you'll need to download GCC. There are lots and lots of different builds; personally, I use the 64-bit build of TDM-GCC. The setup for this might be a bit more complex than you'd care for, so you can go for the 32-bit version or just grab a preconfigured Code::Blocks/TDM-GCC setup here.

Once your setup is done, go ahead and launch Code::Blocks. You don't need to create a project or write any code yet; we're just here to set stuff up or double-check your setup, depending on how you opted to install GCC.

Go into the Settings menu, then select Global compiler settings in the sidebar, and select the Toolchain executables tab. Make sure the Compiler's installation directory textbox matches the folder you installed GCC into. For me, this is C:\TDM-GCC-64. Your path will vary, and this is completely fine; just make sure the path in the textbox is the same as the path you installed to. Pay careful attention to the warning note Code::Blocks shows: this folder must have a bin subfolder which will contain all the relevant GCC executables. If you look into the folder the textbox shows and there isn't a bin subfolder there, you probably have the wrong installation folder specified.

Now, in that same Toolchain executables screen, go through the individual Program Files boxes one by one and verify that the filenames shown in each are correct. You'll want some variation of the following:

  • C compiler: gcc.exe (mine shows x86_64-w64-mingw32-gcc.exe)
  • C++ compiler: g++.exe (mine shows x86_64-w64-mingw32-g++.exe)
  • Linker for dynamic libs: g++.exe (mine shows x86_64-w64-mingw32-g++.exe)
  • Linker for static libs: gcc-ar.exe (mine shows x86_64-w64-mingw32-gcc-ar.exe)
  • Debugger: GDB/CDB debugger: Default
  • Resource compiler: windres.exe (mine shows windres.exe)
  • Make program: make.exe (mine shows mingw32-make.exe)

Again, note that all of these files are in the bin subfolder of the folder shown in the Compiler installation folder box - if you can't find these files, you probably have the wrong folder specified. It's okay if the filenames aren't a perfect match, though; different GCC builds might have differently prefixed filenames, as you can see from my setup.

Once you're done with all that, go ahead and click OK. You can restart Code::Blocks if you'd like, just to confirm the changes will stick even if there's a crash (I've had occasional glitches where Code::Blocks will crash and forget any settings changed since the last launch).

Now, you should be all set. Go ahead and try your little section of code again. You'll want int main(void) to be int main(), but everything else looks good. Try building and running it and see what happens. It should run successfully.

这篇关于在gnc gcc编译器的配置搜索路径中找不到文件可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆