Internal Builder: Cannot run program "g++": The system cannot find the file specified
****** Internal Builder is used for开发者_StackOverflow中文版 build ******
g++ -ot1.o ..\t1.cpp
Internal Builder: Cannot run program "g++": The system cannot find the file specified.
Build error occurred, build is stopped
I am new to eclipse, on windows XP, want to run c/c++ progms + linux build (cygwin is installed with needed packages)
Above said error is coming and builds fails! Please kindly suggest.Edit: appends to path env variable as e:\cygwin\bin;
This is for ref:
How did you setup your Cygwin toolchain in your Eclipse CDT?
(from the Alex Wu's excellent blog post in Alex's Tech Blog)
1/ Install the Cygwin properly, you need following packages:
binutils
gcc
gcc-core
gcc-g++
gcc-mingw-core
gcc-mingw-g++
make
gdb (needed if you want to support debug in eclipse)
you can check your cygwin installation using the '
cygcheck -c
' command
2/ Add
%cygwin%\bin
to your envPATH
, then open the eclipse. you will find the cygwin tool chain will be shown when you open a new c/cpp project wizard.
3/ Configure the GDB.
Go to Windows->Preference->C/C++ -> Debug -> Common Source Lookup
.
Add following 'Path mapping':
\cygdrive\c -> c:\
\cygdrive\d -> d:\
other drives if any .......
I just ran into the same error; it was my first time using eclipse with cygwin. I am fairly new to eclipse as well but I was impressed with how powerful it was. It is unfortunate that this question was asked almost a year ago. In the interim, the software may have changed so much that my advice below may be something of an anachronism as far as this question is concerned.
I am using Eclipse IDE for C/C++ Developers Helios Service Release 2 version 1.3.2.20110218-0812
uname says that the Cygwin version is CYGWIN_NT-6.1-WOW64
After following the (often obsolete) advice of many web posts on this issue, two things finally seemed to make it work. My sysadmin, who alone has privileges to perform software installations, needed to increase my access privileges to the cygwin/bin folder, which now stands as Read and Execute. Second, in eclipse I changed the type of builder to External: File>Properties C/C++ Build, Builder type: External builder. Build now works, though not without throwing some warnings. I am still confused about many of the intricacies of the installation, and I'm not sure why switching to an external builder made such a difference.
I agree with @pajton one needs to correct Eclipse's expectation of the Cygwin binary path from c:\cygwin\usr\bin
to c:\cygwin\bin
as Cygwin authors changed to mounting /usr/bin off the latter.
I needed to change the Eclipse's addition of the Cygwin binary directory to PATH from c:\cygwin\usr\bin
to c:\cygwin\bin
in two configuration locations of my developer build Juno 20120322-1740:
Project Properties / C/C++ Build / Environment
Run / Run Configurations... / Environment
I also changed the path to a shell interpreter in the discovery option Compiler invocation command
from sh
to c:\cygwin\bin\dash.exe
,
Project Properties / C/C++ Build / Discovery Options / Cygwin C Compiler
Project Properties / C/C++ Build / Discovery Options / Cygwin C++ Compiler
This allowed to automatically populate include directories and built-in macros in Project Properties / C/C++ General / Paths and Symbols.
Because only Cygwin-built programs such as bash.exe
, dash.exe
resolve Cygwin-style portable symbolic links, I changed compiler invocation commands from gcc
to gcc-4
and from g++
to g++-4
,
Project Properties / C/C++ Build / Settings / Tool Settings / Cygwin C++ Compiler
Project Properties / C/C++ Build / Settings / Tool Settings / Cygwin C Compiler
Project Properties / C/C++ Build / Settings / Tool Settings / Cygwin C++ Linker
Perhaps, this will be done automatically soon as I see a change in the git repository claiming to address the issue,
- Bug 364733 - Internal Builder does not work with Cygwin toolchain
As I investigated my issue, I went to Help / Install New Software... / Juno / Programming Languages / C/C++ Development Tools.
As I tried to upgrade the selected piece I got an unclear message saying that the requested upgrade was required by other parts. When I pressed "Finish", I received a prompt to restart. I do not know if I upgraded my CDT with these actions.
If you want to catch access violations at run time, create an external tool entry in Run / External Tools... / Configure External Tools. Specify c:\cygwin\bin\bash.exe
as the program, ${workspace_loc:/PROJECT_NAME/CONFIG_NAME}
such as ${workspace_loc:/test/Release}
as the working directory and the command option followed by the program name such as -c "./test.exe"
in the arguments. I found that c:\cygwin\bin\dash.exe
does not route the stack trace produced by the Cygwin DLL to the stderr caught by Eclipse.
Another way to fix this is to go to
project properties / c/c++ build / settings / tool settings / cygwin C compiler
and change the command to
sh -c 'whatever was already there'
This will use sh to invoke the command, and thus it will resolve cygwin links. You will also have to do this for the assembler and linker. Of course you also have to make sure your path points to c:\cygwin\bin before starting eclipse.
精彩评论