简体   繁体   中英

Eclipse CDT error: Unable to compile

I tried to run a simple Hello world program. I am getting this error when I try to build it. What does it mean and how do I resolve it? I am using Windows 7 and I have MinGW and MSys in the %PATH%.

**** 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.  

Code:

#include <iostream>

int main()
{
    std::cout << "Hello, world!" << std::endl;
    return 0;
}

My %PATH% is:

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

I am able to run g++ from cmd:

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.

I found the same problem with a C HelloWorld invoking the MinGW gcc compiler. After quite a bit of experimentation, I have found that the MinGW binutils package is to blame. The latest one doesn't play nice with CDT for some reason: Use this one instead and it will work :)

binutils-2.21-2-mingw32-bin.tar.lzma

NOTE: versions 2.21-3 and later seem to have the problem.

Additionally, the latest GDB 7.3 seems to hang too. Use this one:

gdb-7.2-1-mingw32-bin.tar.lzma

Happy coding:)

PS: I don't even have MinGW or MSYS in the path. As long as MinGW is in C:\MinGW things seem to magically work.

I had similiar problem. Just deleted "C:\MinGW\bin" from the PATH, reinstalled MinGW and it worked. Ecllipse or CLion don't need PATH to be set. CLion even warns that "C:\MinGW\bin" should not be in the PATH.

I used an artifice. I have installed the Dev-Cpp and within it comes installed Mingw32. I copied the Mingw32 to directory c: and rename the mingw32 to c:\MinGW and include to %PATH%. It worked very well.

Try rebooting your system after setting your environment. Please refer to here:

CreateProcess: No such file or directory

How did you create the project? Start with the New->C++ Project. Then under Executable pick the "Hello World C++ Project". On the Toolchains I pick the MinGW GCC toolchain but it's possible you don't have that installed. At any rate this creats a fully compilable executable that makes a good starting point for learning. It puts all the include directories, library paths etc in the project settings.

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