简体   繁体   English

CodeBlocks 中的“没有这样的文件或目录”错误

[英]“No such file or directory” error in CodeBlocks

Here is the steps I followed in CodeBlocks IDE:这是我在 CodeBlocks IDE 中遵循的步骤:

Create a new project->console->C->Name->debug and release->finish

So when I choose main.c and build it, It should show the "Hello World!", but I get this weird mingw32-gcc.exe: error: CreateProcess: No such file or directory error.所以当我选择main.c并构建它时,它应该显示“Hello World!”,但我得到了这个奇怪的mingw32-gcc.exe: error: CreateProcess: No such file or directory error。

I've written and compiled about 20 C files this way, but I don't know what has recently happened to the IDE.我已经用这种方式编写和编译了大约 20 个 C 文件,但我不知道 IDE 最近发生了什么。

I've checked the CodeBlocks forum and googled this problem;No results我检查了 CodeBlocks 论坛并用谷歌搜索了这个问题;没有结果
Any ideas?有什么想法吗?

Bulid Log:建立日志:

-------------- Build: Debug in C (compiler: GNU GCC Compiler)---------------

mingw32-gcc.exe -Wall  -g     -c "C:...\Project Files\C Codes\C\main.c" -o obj\Debug\main.o
mingw32-gcc.exe: error: CreateProcess: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
1 errors, 0 warnings (0 minutes, 0 seconds)

I used CodeBlocks 10.02 three days ago and it compiled and ran the code successfully.我三天前使用了 CodeBlocks 10.02,它成功编译并运行了代码。 It showed this error yesterday.昨天显示这个错误。 I thought that maybe the code file wasn't included so I removed the previous code from the project and added the new file (I do like this for about 20 programs and always get results);我想可能没有包含代码文件,所以我从项目中删除了以前的代码并添加了新文件(我喜欢这个大约 20 个程序并且总是得到结果); but the error still exists.但错误仍然存​​在。 Then I rebuilt the project but still got the error.然后我重建了项目,但仍然出现错误。 I uninstalled ver.10.02 and installed a new version 12.11 today.我今天卸载了 ver.10.02 并安装了新版本 12.11。 Again I get this weird error.我再次收到这个奇怪的错误。

PS It looks like someone else have had this problem too: PS看起来其他人也有这个问题:
mingw32-g++.exe: error: CreateProcess: No such file or directory mingw32-g++.exe: 错误: CreateProcess: 没有那个文件或目录

Got it finally:终于明白了:

In my case, the problem resulted from a program called EGCS (Experimental/Enhanced GNU Compiler System) .就我而言,问题是由一个名为EGCS (Experimental/Enhanced GNU Compiler System) 的程序引起的 I installed it as a prerequisite for PSCAD(Power Systems CAD) along with a FORTRAN Compiler.我将它安装为 PSCAD(Power Systems CAD)和 FORTRAN 编译器的先决条件。 Just remove it, and you'll be fine.把它去掉,你会没事的。
(Sadly, I deleted the entire PATH environmental variable due to a mistake. So what?...I ended up installing a new Win7 but after uninstalling my Ubuntu which again due to the Boot difficulties which resulted from uninstalling GRUB , I again ended up messing around with fixmbr and fixboot fellas(But I've lost my Laptop DVD!)...In summary, The EGCS laughed at me for a 0.5*MONTH...) (遗憾的是,由于错误,我删除了整个 PATH 环境变量。那又怎样?...我最终安装了一个新的 Win7,但在卸载我的 Ubuntu 之后,由于卸载 GRUB 导致启动困难,我再次结束了搞乱 fixmbr 和 fixboot 家伙(但我丢失了我的笔记本电脑 DVD!)......总而言之,EGCS 嘲笑我 0.5*MONTH......)

For more information about such problems visit here(Code::Blocks Forum)有关此类问题的更多信息,请访问此处(代码::块论坛)

Codeblocks seems to be calling gcc correct -- I'm not seeing anything wrong with the way it's being invoked. Codeblocks 似乎正确地调用了 gcc——我没有发现它被调用的方式有什么问题。 The error message you're getting:您收到的错误消息:

gcc.exe: error: CreateProcess: No such file or directory gcc.exe:错误:CreateProcess:没有那个文件或目录

indicates that there is something wrong with your installation of mingw-gcc.表示您安装的 mingw-gcc 有问题。 Since you said that this was working previously, that likely means some files required for gcc to function are either corrupted, inadvertently renamed, moved elsewhere or accidentally deleted.由于您之前说过这是有效的,这可能意味着 gcc 运行所需的某些文件已损坏、无意中重命名、移动到其他地方或意外删除。

In fact, I was able to reproduce that exact error by renaming cc1.exe .事实上,我能够通过重命名cc1.exe来重现那个确切的错误。 This is the C compiler that gcc needs to able to compile a C source file.这是 gcc 需要能够编译 C 源文件的 C 编译器。 On my install for Mingw-4.6.3, this resides under ./libexec/gcc/i686-w64-mingw32/4.6.3 .在我安装 Mingw-4.6.3 时,它位于./libexec/gcc/i686-w64-mingw32/4.6.3下。 Yours may be different depending on which mingw version and variant you're using.根据您使用的 mingw 版本和变体,您的可能会有所不同。

I recommend downloading and reinstalling your copy of gcc altogether since fixing this manually can be tricky.我建议完全下载并重新安装您的 gcc 副本,因为手动修复此问题可能很棘手。

The answers here failed to solve my problem!这里的答案未能解决我的问题! My friend got it fixed for me.我朋友帮我修好了。 The solution was pretty simple and straight forward.解决方案非常简单直接。 The problem that occurred was that compiler couldn't chain itself with the MinGW (Minimalist GNU for Windows) which could have been modified by some other make files for makefiles softwares like CMake etc. So the solution is:发生的问题是编译器无法将自己与 MinGW(Windows 的 Minimalist GNU)链接起来,而 MinGW(Windows 的 Minimalist GNU)可能已被其他一些 makefiles 软件(如 CMake 等)的 make 文件修改。所以解决方案是:

  1. Open Codeblocks and in the top Tool Bar select the Settings option and under that select the compiler option.打开 Codeblocks 并在顶部工具栏中选择设置选项,然后在该选项下选择编译器选项。
  2. It will open the Compiler Setting Window.它将打开编译器设置窗口。 Here select the Global Compiler settings(with a Gear Symbol) and in the sub-options select the Toolchain executables option.在这里选择全局编译器设置(带有齿轮符号)并在子选项中选择工具链可执行文件选项。
  3. Under this select the Compiler's installation directory.在此选择编译器的安装目录。 Here browse files to select: C:\\Program Files(x86)\\Codeblocks\\MinGW\\bin这里浏览文件选择:C:\\Program Files(x86)\\Codeblocks\\MinGW\\bin
  4. Now select the Auto-detect option on the right.现在选择右侧的自动检测选项。

It should solve your problem and I hope you got an understanding of what the problem was!!!它应该可以解决您的问题,我希望您了解问题所在!!! Happy Programming!编程快乐!

After two days of struggle, I confirmed the solution from codesavory and Anand MP.经过两天的挣扎,我确认了codesavory和Anand MP的解决方案。

All the reason is the Toolchain Executables.所有的原因都是工具链可执行文件。 I finally found that it was cygwin's path!终于发现是cygwin的路径了!

After I change to D:\\GreenSoft\\CodeBlocks\\MinGW, it compiles ok now!在我更改为 D:\\GreenSoft\\CodeBlocks\\MinGW 后,它现在可以编译了!

I think the problem take place at the install step: codeblocks detect everywhere on your PC to find a existing gcc, and let you choose one as your favorite.我认为问题发生在安装步骤:代码块检测您 PC 上的任何地方以查找现有的 gcc,并让您选择一个作为您最喜欢的。 It even forgot that the installer is already bundled with a minGW!, and it does not show where the detected gcc are located!它甚至忘记了安装程序已经捆绑了一个minGW!,并且它没有显示检测到的gcc所在的位置! So if you simply confirm one and forget it, it will abandon the bundled minGW.所以如果你简单的确认一个忘记了,它就会放弃捆绑的minGW。

I just solved this error.我刚刚解决了这个错误。 Probably I got this when I moved a file accidentally which was under execution in C-Free IDE.可能是我意外移动了一个正在 C-Free IDE 中执行的文件时得到了这个。 All you have to do is ,locate the g++.exe file in your Program files.您所要做的就是在您的程序文件中找到 g++.exe 文件。 Just go through the program files of the particular IDE and find mingW folder and locate the 'g++.exe' inside it.只需浏览特定 IDE 的程序文件并找到 mingW 文件夹并在其中找到“g++.exe”。

This usually happens when the compilers PATH in Codeblocks is not a valid one.这通常发生在 Codeblocks 中的编译器 PATH 无效时。 In my case it was pointing to C:/MinGW.就我而言,它指向 C:/MinGW。 Which Codeblocks found out using its auto detect feature.哪些代码块使用其自动检测功能发现。

To get rid of the error you need to change the path back to the one that is present within the Codeblocks program folder.要消除错误,您需要将路径更改回 Codeblocks 程序文件夹中的路径。

In my case it was - C:\\Program Files (x86)\\CodeBlocks\\MinGW.就我而言,它是 - C:\\Program Files (x86)\\CodeBlocks\\MinGW。

You can change the path in Codeblocks by following these steps.您可以按照以下步骤更改 Codeblocks 中的路径。 Menu bar-> Settings-> Compiler-> Toolchain Executables.菜单栏-> 设置-> 编译器-> 工具链可执行文件。 Then enter the corresponding valid compiler directory path.然后输入对应的有效编译器目录路径。

Hope this solves your problem.希望这能解决您的问题。

I still had a problem with that error.我仍然遇到那个错误的问题。 Turns out it was there beacause I had MinGW installed externally before installing CodeBlocks.原来是因为我在安装 CodeBlocks 之前在外部安装了 MinGW。

In that case check if your directory path (explained how to change it above) isn't C:\\MinGW\\bin but instead C:\\Program Files (x86)\\CodeBlocks\\MinGW\\bin since it may cause the error to pop up.在这种情况下,检查您的目录路径(上面解释了如何更改它)不是C:\\MinGW\\bin而是C:\\Program Files (x86)\\CodeBlocks\\MinGW\\bin因为它可能会导致错误弹出.

Open command line and type in:打开命令行并输入:

mingw-get update && mingw-get install mingw32-gcc

This will download the missing GCC files.这将下载丢失的 GCC 文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM