我尝试运行一个简单的 Hello world 程序。当我尝试构建它时出现此错误。这是什么意思,我该如何解决?我使用的是 Windows 7,%PATH% 中有 MinGW 和 MSys。
**** Build of configuration Debug for project learn ****
**** Internal Builder is used for build ****
g++ -IC:\MinGW\lib\gcc\mingw32\4.5.2\include\c++ -IC:\MinGW\libexec\gcc\mingw32\4.5.2 -O0 -g3 -Wall -c -fmessage-length=0 -osrc\learn.o ..\src\learn.cpp
g++: CreateProcess: No such file or directory
Build error occurred, build is stopped
Time consumed: 78 ms.
代码:
#include <iostream>
int main()
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
我的 %PATH% 是:
C:\Users\Hari>echo %PATH%
C:\Program Files (x86)\MiKTeX 2.8\miktex\bin;C:\sml\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Program Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Common Files\Roxio Shared\10.0\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;C:\Program Files (x86)\QuickTime\QTSystem\;G:\svn\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\SlikSvn\bin\;C:\cygwin\bin\;C:\Program Files\apache-maven-2.2.1\bin\;C:\PsTools;C:\MinGW\msys\1.0\bin;C:\MinGW\bin
我可以从 cmd 运行 g++:
C:\Users\Hari>g++ --version
g++ (GCC) 4.4.3
Copyright (C) 2010 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
最佳答案
我在调用 MinGW gcc 编译器的 C HelloWorld 中发现了同样的问题。经过大量实验,我发现 MinGW binutils 包是罪魁祸首!出于某种原因,最新的一个与 CDT 不兼容。改用这个,它会起作用:)
binutils-2.21-2-mingw32-bin.tar.lzma
注意:版本 2.21-3 及更高版本似乎有问题。
此外,最新的 GDB 7.3 似乎也挂了。使用这个:
gdb-7.2-1-mingw32-bin.tar.lzma
快乐编码:)
PS:我的路径中甚至没有 MinGW 或 MSYS。只要 MinGW 在 C:\MinGW 中,事情似乎就神奇地起作用了。
关于c++ - Eclipse CDT 错误 : Unable to compile,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5847442/