Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » Bad file number
Bad file number [message #551322] Thu, 05 August 2010 20:40 Go to next message
Eclipse UserFriend
I'm using CDT Helios with Cygwin 1.7.5 on Windows 7 and I've run into a small problem with the build system.

I have a project with an existing Makefile and I'm trying to compile a single executable from a larger project. I've changed the C/C++ Build > Behavior tab so that "Build (Incremental Build)" is set to annotate.

When I try to build the project within Eclipse, I get this on the console and the annotate.exe file doesn't build:


**** Build of configuration AnnotateDebug for project trunk ****

make annotate
/bin/sh: /c/cygwin/bin/gcc: Bad file number
make: execvp: gcc: Bad file number
make: execvp: gcc: Bad file number
make: execvp: gcc: Bad file number
make: execvp: gcc: Bad file number
make: execvp: gcc: Bad file number
make: execvp: gcc: Bad file number
g++ -DSPS_VERSION=100805 -Iinclude -O3 -ffunction-sections -fdata-sections -Wno-deprecated -Wno-write-strings -march=i686 -L../install/win32-g++/lib -L../install/win32-g++/bin annotate.cpp -o annotate
make: execvp: g++: Bad file number
make: *** [annotate] Error 127

When I load up a cmd window and type in "sh", browse to the correct directory and type "make annotate" I get no errors and the annotate.exe gets created. When I'm in "sh" and try to execute /c/cygwin/bin/gcc I do get the "Bad file number" error, but executing just gcc works perfectly.

The confusing thing is that it seems like "make all" works for the majority of executables, it's just a few that show this issue. I can just copy and paste the g++ command into a cmd window and everything works just fine, so I'm at a bit of a loss. C:\cygwin\bin is definitely part of the PATH environment variable and for *some* executables in the Makefile, Eclipse can compile just fine. Any help would be appreciated!
Re: Bad file number [message #644473 is a reply to message #551322] Sat, 11 December 2010 14:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi all,

I have the same problem. I run "Hello World" in eclipse 3.5, CDT environment and get the following error:

**** Build of configuration Default for project test****

make all
g++ -c -o test.o test.cpp
make: execvp: g++: Bad file number
make: *** [test.o] Error 127

I have played with the compiler flags, build configuration and everything does not take me out... Mad

but If run it from the shell (cywgin).. it runs OK.. Smile

I am running Windoews 7..

Any idea?

Regards

Re: Bad file number [message #1828811 is a reply to message #551322] Fri, 19 June 2020 02:46 Go to previous message
Eclipse UserFriend
I had the same problem.
First run the program through cygwin or mingw whichever you have installed.
go to bash, run the executable.
then you can run as many times in eclipse.
Previous Topic:In eclipse, when I input an "Enter" key in ".c" file, next time I open this file
Next Topic:Failed to execute MI command: -exec-run
Goto Forum:
  


Current Time: Mon Jul 07 21:23:14 EDT 2025

Powered by FUDForum. Page generated in 0.03809 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top