CreateProcess: No such file or directory
Solution 1
According to Code::Blocks wiki, you need to add C:\MinGW\libexec\gcc\mingw32\MinGW-Version
to your PATH
. There is no need to restart, but you need to open another terminal in order to get the newest PATH
settings.
For MinGW-w64, that's <mingw install directory>\libexec\gcc\x86_64-w64-mingw32\4.7.0\
Solution 2
I had a similar problem, caused by not installing the C++ compiler. In my case I was compiling .cpp files for a Python extension, but the compiler is first invoked as c:\mingw\bin\gcc.exe.
Internally, gcc.exe would notice it was asked to compile a .cpp file. It would try to call g++.exe and fail with the same error message:
gcc.exe: CreateProcess: no such file or directory
Solution 3
I just had this problem.
In my case, the problem was due to problems when downloading the packages for GCC. The mingw-get program thought it finished the download, but it didn't.
I wanted to upgrade GCC, so I used mingw-get to get the newer version. For some reason, mingw-get thought the download for a particular file was finished, but it wasn't. When it went to extract the file, I guess it issued an error (which I didn't even bother to look -- I just ran "mingw-get update && mingw-get install mingw32-gcc" and left it there).
To solve, I removed gcc by doing "mingw-get remove mingw32-gcc" and also removed the package file (the one mingw-get didn't fully download), which was in the mingw cache folder ("C:\MinGW\var\cache\mingw-get\packages" in my system), then ran the install command again. It download and installed the missing parts of GCC (it had not fully downloaded the package gcc-core).
That solved my problem.
Interestingly enough, mingw-get was smart enough to continue the download of gcc-core even after me having deleted the package file in the cache folder, and also removed the package mingw32-gcc.
I think the more fundamental problem was that since gcc-core files were not installed, cc1 wasn't there. And gcc uses cc1. I guess that, when gcc tried to start cc1, it used CreateProcess somewhere passing the path of cc1, which was not the path of an existing file. Thus the error message.
Solution 4
So this is a stupid error message because it doesn't tell you what file it can't find.
Run the command again with the verbose flag gcc -v
to see what gcc is up to.
In my case, it happened it was trying to call cc1plus
. I checked, I don't have that. Installed mingw's C++ compiler and then I did.
Solution 5
I had exactly the same problem.
After a recheck of my PATH
, I realized I installed both Mingw
(64 bit) and Cygwin
(32 bit).
The problem is that both Mingw
and Cygwin
have g++
.
By deactivating the path of Cygwin
, the error disappeared.

Insomaniacal
Updated on July 18, 2022Comments
-
Insomaniacal 3 months
I am getting this error whenever I try to run GCC outside of its installation directory (
E:\MinGW\bin
).So, let's say I am in
E:\code
and have a file calledone.c
. Running:gcc one.c -o one.exe
will give me this error:gcc: CreateProcess: No such file or directory
The only workaround is to navigate to its installation directory, run gcc from there, and specify all the other paths. My environmental variable
Path
containsE:\MinGW\bin
.Any suggestions to fixing this problem? I am running Windows XP SP3.
-
Neil Fan about 11 yearsLuis Bruno's answer fixed my problem. Make sure you installed the proper compiler. I'm trying to compile .cpp files with gcc.exe, while g++ is actually required. mingw-get install g++ cleared the error out.
-
David S over 10 yearsNope... didn't help me one bit.
-
Adder almost 10 yearsMy disk was full during install and I guess this caused the problem for me, even if mingw did still install without a warning.
-
david a. over 9 yearsIt was my problem as well. I'm on 64bit gcc (mingw64 project). Adding <mingw install directory>\libexec\gcc\x86_64-w64-mingw32\4.7.0\ fixed it.
-
Leonardo Raele about 9 yearsIf he didn't added it do PATH, the prompt won't even recognize gcc as a program.
-
Ben Voigt over 7 yearsBecause many Unix compilers follow the convention that
.c
is the extension for C language files, and.C
is (along with.c++
,.cpp
, and.cxx
) the extension for C++ files, and mingw follows this convention since its roots are Unix. -
POQDavid over 7 yearsSince the mingw-w64 project on sourceforge.net is moving to mingw-w64.org i suggest to use mingw-w64.org
-
barlop over 7 yearshow do you load mingwshell?
-
Trent over 7 yearsThat's a good question. This was from a while ago and since then I've reformatted, but from memory I installed via mingw.org/wiki/getting_started
-
barlop over 7 yearscan you show me a specific pic e.g. on google images that shows what the mingw gui you have in mind/remember is?
-
Vadzim about 6 yearsIn my command-line-only case the problem was fixed by conversely cleaning the
PATH
. ProcMon was very helful in diagnostics. -
splash over 4 yearsYou could also define the parameter
-x c
to specify explicitlyc
as the language for the following input files. -
Casey Kuball over 1 yearAfter hunting down this issue for years, I had a similar issue relating to cc1/cc1plus. GCC for some reason was looking for cc1.exe along all paths in the PATH. After failing to find anywhere, gcc errored with
CreateProcess: No such file or directory.
Added a suitable cc1.exe path to PATH and build was successful. -
Casey Kuball over 1 yearI had a similar issue (internally it was attempting to call cc1). cc1 was included with my distribution, but the include path was not in my PATH.
-
wovano about 1 yearGood idea to use ProcMon, since the error is not so verbose, and apparently there are many possible causes for this specific (cryptical) error message. In my case, I found out that g++ was looking for
as
(the assembler), which was missing. Installing it finally solved my issue.