简体   繁体   中英

“No such file or directory” error in CodeBlocks

Here is the steps I followed in 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.

I've written and compiled about 20 C files this way, but I don't know what has recently happened to the IDE.

I've checked the CodeBlocks forum and googled this problem;No results
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. 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); 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. Again I get this weird error.

PS It looks like someone else have had this problem too:
mingw32-g++.exe: error: CreateProcess: No such file or directory

Got it finally:

In my case, the problem resulted from a program called EGCS (Experimental/Enhanced GNU Compiler System) . I installed it as a prerequisite for PSCAD(Power Systems CAD) along with a FORTRAN Compiler. 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...)

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. The error message you're getting:

gcc.exe: error: CreateProcess: No such file or directory

indicates that there is something wrong with your installation of 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.

In fact, I was able to reproduce that exact error by renaming cc1.exe . This is the C compiler that gcc needs to able to compile a C source file. On my install for Mingw-4.6.3, this resides under ./libexec/gcc/i686-w64-mingw32/4.6.3 . Yours may be different depending on which mingw version and variant you're using.

I recommend downloading and reinstalling your copy of gcc altogether since fixing this manually can be tricky.

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:

  1. Open Codeblocks and in the top Tool Bar select the Settings option and under that select the compiler option.
  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
  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.

All the reason is the Toolchain Executables. I finally found that it was cygwin's path!

After I change to D:\\GreenSoft\\CodeBlocks\\MinGW, it compiles ok now!

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. It even forgot that the installer is already bundled with a minGW!, and it does not show where the detected gcc are located! So if you simply confirm one and forget it, it will abandon the bundled minGW.

I just solved this error. Probably I got this when I moved a file accidentally which was under execution in C-Free IDE. All you have to do is ,locate the g++.exe file in your Program files. Just go through the program files of the particular IDE and find mingW folder and locate the 'g++.exe' inside it.

This usually happens when the compilers PATH in Codeblocks is not a valid one. In my case it was pointing to 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.

In my case it was - C:\\Program Files (x86)\\CodeBlocks\\MinGW.

You can change the path in Codeblocks by following these steps. 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.

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.

Open command line and type in:

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

This will download the missing GCC files.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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