C语言 另一个 MinGW“gcc:错误:CreateProcess:没有这样的文件或目录”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13321980/
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
Yet Another MinGW "gcc: error: CreateProcess: No such file or directory"
提问by eang
I have installed MinGW C compiler in Windows 8 (64 bit) through the GUI installer. But when I try to compile a C program, gcc says: gcc: CreateProcess: No such file or directory
我已经通过 GUI 安装程序在 Windows 8(64 位)中安装了 MinGW C 编译器。但是当我尝试编译 C 程序时,gcc 说:gcc: CreateProcess: No such file or directory
It is a common bug, and I have tried all the solutions I found, without success.
这是一个常见的错误,我已经尝试了我找到的所有解决方案,但都没有成功。
In particular, (following CreateProcess: No such file or directory) I have tried to:
特别是,(在CreateProcess: No such file or directory 之后)我曾尝试:
- [EDITED] Add C:\MinGw\libexec\gcc\mingw32\4.7.2to my system PATH
Uninstall and re-install gcc through mingw-get CLI:
mingw-get remove mingw32-gcc
mingw-get install mingw32-gcc
- [已编辑] 将C:\MinGw\libexec\gcc\mingw32\4.7.2 添加到我的系统路径
通过 mingw-get CLI 卸载并重新安装 gcc:
mingw-get 删除 mingw32-gcc
mingw-get 安装 mingw32-gcc
Other suggestions?
其他建议?
EDIT: verbose gcc output:
编辑:详细的 gcc 输出:
> gcc -v helloWorld.c
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.7.2/lto-
wrapper.exe
Target: mingw32
Configured with: ../gcc-4.7.2/configure --enable-languages=c,c++,ada,fortran,obj
c,obj-c++ --disable-sjlj-exceptions --with-dwarf2 --enable-shared --enable-libgo
mp --disable-win32-registry --enable-libstdcxx-debug --disable-build-poststage1-
with-cxx --enable-version-specific-runtime-libs --build=mingw32 --prefix=/mingw
Thread model: win32
gcc version 4.7.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=i386' '-march=i386'
cc1plus -quiet -v -iprefix c:\mingw\bin\../lib/gcc/mingw32/4.7.2/
OPTIONS.C -quiet -dumpbase OPTIONS.C -mtune=i386 -march=i386 -auxbase OPTIONS -
version -o C:\Users\elvis\AppData\Local\Temp\cc4fWSvg.s
gcc: error: CreateProcess: No such file or directory
采纳答案by Michael Burr
You shouldn't add C:\MinGw\libexec\gcc\mingw32\4.7.2to the path.
你不应该添加C:\MinGw\libexec\gcc\mingw32\4.7.2到路径中。
Add: c:\MinGW\bin
添加: c:\MinGW\bin
You may need to reboot to ensure that the path is made available to all processes properly.
您可能需要重新启动以确保该路径可供所有进程正确使用。
Another suggestion is to use a different MinGW distribution. It's been a long time since I used an 'official' MinGW distribution because the installation steps were so byzantine and fragile. I've heard they've made large advances to the installer, but from what I hear it still seems to be rather complicated and fragile.
另一个建议是使用不同的 MinGW 发行版。自从我使用“官方”MinGW 发行版以来已经有很长时间了,因为安装步骤是如此繁琐和脆弱。我听说他们在安装程序方面取得了很大进展,但据我所知,它似乎仍然相当复杂和脆弱。
TDM's installerjust works, but I think the TDM release isn't quite to 4.7.2.
TDM 的安装程序可以正常工作,但我认为 TDM 版本不是 4.7.2。
The nuwen distribution'sinstallation is just unpacking an archive where you want the thing (I love that!) and making sure the path points to the location of gcc.exe. Nuwen also packages the boost libraries, which is nice.
该nuwen分布的安装只是解包在您想要的东西存档(我喜欢这个!),并确保路径指向gcc.exe的位置。Nuwen 还打包了 boost 库,这很好。
I case it helps, here's what I get from gcc -v hello.c(c:\mingw.4.7.2\binis in the path`):
如果它有帮助,这是我从gcc -v hello.c(c:\mingw.4.7.2\bin在路径中)得到的:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/lto-wrapper.exe
Target: i686-pc-mingw32
Configured with: ../src/configure --prefix=/c/temp/gcc/dest --with-gmp=/c/temp/gcc/gmp --with-mpfr=/c/temp/gcc/mpfr --with-mpc=/c/temp/gcc/mpc --enable-languages=c,c++ --with-arch=i686 --with-tune=generic --disable-libstdcxx-pch --disable-nls --disable-shared --disable-sjlj-exceptions --disable-win32-registry --enable-checking=release --enable-lto
Thread model: win32
gcc version 4.7.2 (GCC)
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/cc1.exe -quiet -v -iprefix c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/ hello.c -quiet -dumpbase hello.c -mtune=generic -march=i686 -auxbase hello -version -o C:\Users\mikeb\AppData\Local\Temp\cct1oltc.s
GNU C (GCC) version 4.7.2 (i686-pc-mingw32)
compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/../../../../i686-pc-mingw32/include"
ignoring duplicate directory "c:/mingw.4.7.2/lib/gcc/../../lib/gcc/i686-pc-mingw32/4.7.2/include"
ignoring nonexistent directory "c:/temp/gcc/dest/include"
ignoring nonexistent directory "/c/temp/gcc/dest/include"
ignoring duplicate directory "c:/mingw.4.7.2/lib/gcc/../../lib/gcc/i686-pc-mingw32/4.7.2/include-fixed"
ignoring nonexistent directory "c:/mingw.4.7.2/lib/gcc/../../lib/gcc/i686-pc-mingw32/4.7.2/../../../../i686-pc-mingw32/include"
ignoring nonexistent directory "/mingw/include"
#include "..." search starts here:
#include <...> search starts here:
c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/include
c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/../../../../include
c:\mingw.4.7.2\bin\../lib/gcc/i686-pc-mingw32/4.7.2/include-fixed
End of search list.
GNU C (GCC) version 4.7.2 (i686-pc-mingw32)
compiled by GNU C version 4.7.2, GMP version 5.0.5, MPFR version 3.1.1-p2, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 8461a53e6fc78ff58191bda61fe9586d
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
as -v -o C:\Users\mikeb\AppData\Local\Temp\ccqRcYAj.o C:\Users\mikeb\AppData\Local\Temp\cct1oltc.s
GNU assembler version 2.22 (i686-pc-mingw32) using BFD version (GNU Binutils) 2.22
COMPILER_PATH=c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/;c:/mingw.4.7.2/bin/../libexec/gcc/
LIBRARY_PATH=c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/;c:/mingw.4.7.2/bin/../lib/gcc/;c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/../../../
COLLECT_GCC_OPTIONS='-v' '-mtune=generic' '-march=i686'
c:/mingw.4.7.2/bin/../libexec/gcc/i686-pc-mingw32/4.7.2/collect2.exe -Bdynamic c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/../../../crt2.o c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/crtbegin.o -Lc:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2 -Lc:/mingw.4.7.2/bin/../lib/gcc -Lc:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/../../.. C:\Users\mikeb\AppData\Local\Temp\ccqRcYAj.o -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -ladvapi32 -lshell32 -luser32 -lkernel32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt c:/mingw.4.7.2/bin/../lib/gcc/i686-pc-mingw32/4.7.2/crtend.o
回答by Dan H
In my case, I had uninstalled a few items in MinGW to save space on my SSD. Installing mingw32-gcc dev class fixed this problem for me.
就我而言,我在 MinGW 中卸载了一些项目以节省 SSD 上的空间。安装 mingw32-gcc dev class 为我解决了这个问题。
回答by Arun
I had the same error. I have 64 bit win 7 OS. First I installed 32 bit MinGW, gcc was installed successfully but showing this error. Tried installing 64 bit MinGW but failed to install. Searched a lot, tried many things but nothing worked.
我有同样的错误。我有 64 位 win 7 操作系统。首先我安装了 32 位 MinGW,gcc 安装成功但显示此错误。尝试安装 64 位 MinGW,但安装失败。搜索了很多,尝试了很多东西,但没有任何效果。
Finally installed "tdm64-gcc-5.1.0-2" from this link >> https://sourceforge.net/projects/tdm-gcc/?source=typ_redirect
最后从这个链接安装了“tdm64-gcc-5.1.0-2”>> https://sourceforge.net/projects/tdm-gcc/?source=typ_redirect
It installed & worked in single attempt without any error. Nothing special tried.
它在一次尝试中安装和工作,没有任何错误。没有什么特别的尝试。
And the basic important point, after installation need to add "bin" directory on env path ('C:\TDM-GCC-64\bin' in my case). Then check gcc installation from this command on console >> "gcc --version" , this will show the gcc version installed.
最重要的一点是,安装后需要在 env 路径上添加“bin”目录(在我的例子中是'C:\TDM-GCC-64\bin')。然后在控制台上通过此命令检查 gcc 安装 >> "gcc --version" ,这将显示安装的 gcc 版本。
回答by Marc.2377
In my case, getting rid of the [=n]parameter when specifying -fltosolved the problem.
就我而言,[=n]在指定时去掉参数-flto解决了问题。
Specifically, instead of using
具体来说,而不是使用
-flto=6
in CFLAGS, CXXFLAGS and LDFLAGS, I'm now using simply
在 CFLAGS、CXXFLAGS 和 LDFLAGS 中,我现在简单地使用
-flto
Looks like this is a MinGW-w64 bug, thought at this point I'm not sure whether it might be caused by my using of the -j6parameter when invoking make.
看起来这是一个 MinGW-w64 错误,此时我不确定这是否可能是我-j6在调用make时使用参数引起的。
For future reference, my entire command line is as follows:
为了将来参考,我的整个命令行如下:
mingw32-make -f makefile.gcc CFLAGS="-std=c11 -pipe -O3 -flto" CXXFLAGS="-std=c++14 -pipe -O3 -flto" LDFLAGS="-pipe -O3 -flto -static-libgcc -static-libstdc++ -s -Wl,--allow-multiple-definition" BUILD=release RUNTIME_LIBS=static DEBUG_FLAG=0 USE_AUI=0 USE_HTML=0 USE_MEDIA=0 USE_OPENGL=0 USE_PROPGRID=0 USE_QA=0 USE_RIBBON=0 USE_RICHTEXT=0 USE_STC=0 USE_WEBVIEW=0 USE_XRC=0 CFG="-stl-static_runtime-O3-flto" -j6
This is for building wxWidgets' "Minimal Sample". About -Wl,--allow-multiple-definition: It's intended to circumvent yet another toolchain bug. More info hereand here.
这是用于构建wxWidgets的“最小样本”。关于-Wl,--allow-multiple-definition:它旨在规避另一个工具链错误。更多信息在这里和这里。
回答by christianbueno.1
I installed MinGW of the ofcial website.
I select "Basic Setup"( I only wanted get c compiler), and I marked all package, after this installation I added the path, in my case.
我安装了官方网站的MinGW 。
我选择“基本设置”(我只想要获取 c 编译器),并标记所有包,在此安装后,我添加了路径,就我而言。
C:\MinGW\bin.
C:\MinGW\bin。
I created a c file in
我在其中创建了 ac 文件
C:\Users\christian\Documents\C projects\
C:\Users\christian\Documents\C 项目\
with the name untitled1.c
名称为 untitled1.c
Wen I tried to use the command
文我尝试使用命令
gcc untitled.c
gcc无题.c
the command promt showed me that message.
命令提示符向我显示了该消息。
gcc: CreateProcess: No such file or directory
gcc: CreateProcess: 没有那个文件或目录
How did I solve this problem?我是如何解决这个问题的?
我删除了所有包,
-Open "MinGW Installation Manager"
-Select "Basic Setup".
-Mark for removal all packages.
-Select "Installation" tap.
-Click in Apply changes.
-After you can install those again.
- 打开“MinGW 安装管理器” -
选择“基本设置”。
- 标记以删除所有包。
- 选择“安装”点击。
- 单击应用更改。
- 在您可以再次安装它们之后。
Operating system
操作系统
- Edition: Windows 10 Pro
- Version: 1607
- Os build: 14393.187
- 版本:Windows 10 专业版
- 版本:1607
- 操作系统版本:14393.187
回答by Michael Hou
I have the same problem.
我也有同样的问题。
I have a startgcc.batin my folder.
It's OK for me just after remove double quotation marks in my PATHassignment.
my bat script:
startgcc.bat我的文件夹中有一个。
在我的PATH作业中删除双引号后,我就可以了。我的蝙蝠脚本:
@title gcc-mingw
@rem @cd /d %~dp0
@rem below line will fail and got error: gcc.exe: error: createprocess: no such file or directory
@rem @set path="C:\mingw64\bin";%path%
@rem below lines works ok without double quotation marks
@set path=C:\mingw64\bin;%path%
@set path=C:\mingw64\opt\bin\;%path%
@cmd
回答by Casey
In my case, multiple toolchains had placed different gcc installs into PATH.
就我而言,多个工具链已将不同的 gcc 安装放置到 PATH 中。
(This is turning into a switch!)
(这变成了一个开关!)
回答by Honghe.Wu
In my case, the installer mingw-get-setup.exefailed to download some files, so the gcc complication tool chain is broken, when rerun mingw-get-setup.exeand get the lost files, it is OK.
就我而言,安装程序mingw-get-setup.exe无法下载某些文件,因此gcc复杂工具链已损坏,重新运行mingw-get-setup.exe并获取丢失的文件时,就可以了。

