Error Calling Fdopen Bad File Number
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up calling fdopen: Bad file descriptor up vote 5 down vote favorite I'm getting the following error when trying to compile my program: calling fdopen: Bad file descriptor I've read this might be a problem related to including a precompiled header in one of my header files. The file which is causing the error includes the stdio.h header in it so I have access to the FILE type. If I remove this, the error disappears, but then I can't use the FILE type. Does anybody know how I can fix this? c gcc fdopen share|improve this question edited Sep 13 '11 at 4:08 Brian Webster 17.3k37115199 asked Feb 14 '10 at 19:43 LandonSchropp 3,8841247104 4 Try isolating the problem into a bare bones program (--i.e., a new seperate file with a main in it and only the code that fails). Then update your question. We can't give feedback without some code. –Hassan Syed Feb 14 '10 at 19:46 1 Can you post the simplest self-contained code that reproduces the issue you are experiencing? –Mark Byers Feb 14 '10 at 19:47 what version of gcc? –bmargulies Feb 14 '10 at 20:12 Source code please? We're not psychic debuggers nor clairvoyants... –t0mm13b Feb 16 '10 at 20:26 add a comment| 2 Answers 2 active oldest votes up vote 6 down vote Hard to tell without details, but it's indeed most probably due to an out-of-date precompiled header. Remove all .gch files and try again. This is frequently reported as a bug against GCC, see the bugzilla entry here share|improve this answer answered Feb 16 '10 at 20:20 F'x 8,181553112 1 Thanks, this happened to be my issue. –Derrick May 21 '11 at 17:52 add a comment| up vote 0 down vote accepted Sorry, I just forgot to include the stdio.h header file. I feel kind of stupid now. share|improve this answer edited Sep 13 '11 at 4:09 Brian Webster 17.3k37115199 answered Feb 17 '10 at 3:49 LandonSchropp 3,8841247104 add a comment| Your Answer draft saved draft discarded Sign up or log in Sign up using Google Sign up using Facebook Sign up using Email and Password Post as a guest Name Email Post as a guest Name Email discard By p
to check the nightly builds in the forum. Home Help Search Login Register Wiki Code::Blocks » Developer forums (C::B DEVELOPMENT STRICTLY!) » Development » fdopen: Bad file descriptor « previous next » Send this topic Print Pages: [1] Go Down Author Topic: fdopen: Bad file descriptor (Read 12698 times) killerbot Administrator Lives here! Posts: 4971 fdopen: Bad file descriptor « on: August 14, 2007, 03:43:10 pm » Does anyone else http://stackoverflow.com/questions/2262484/calling-fdopen-bad-file-descriptor get this on linux : Quoteif g++ -DHAVE_CONFIG_H -I. -I. -I../../src/include -I/usr/lib64/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread -I../../src/include/wxscintilla/include -I../../src/include -I../../src/include/scripting/include -I../../src/include/scripting/sqplus -I../../src/include/wxFlatNotebook/include -I../../src/src/wxAUI -DENABLE_BINRELOC -DAPP_PREFIX="\"/usr/local\"" -Ulinux -Uunix -O2 -ffast-math -g -O2 -DCB_PRECOMP -Winvalid-pch -fPIC -DPIC -fexceptions -MT app.o -MD -MP -MF ".deps/app.Tpo" -c -o app.o app.cpp; \ then mv -f ".deps/app.Tpo" ".deps/app.Po"; http://forums.codeblocks.org/index.php?topic=6678.0 else rm -f ".deps/app.Tpo"; exit 1; fiIn file included from ../../src/include/logmanager.h:5, from app.cpp:55:../../src/include/logger.h:4:25: error: calling fdopen: Bad file descriptormake[3]: *** [app.o] Error 1 Logged killua Multiple posting newcomer Posts: 11 Re: fdopen: Bad file descriptor « Reply #1 on: August 14, 2007, 03:47:53 pm » Yeah, I got it just a bit ago, but I decided to do a make clean, and then a re-make. I'll see if I still get it after it gets to that point...[EDIT] Update: Still get the error after doing a make clean...will await a fix to be submitted before I proceed. « Last Edit: August 14, 2007, 03:58:51 pm by killua » Logged mandrav Project Leader Administrator Lives here! Posts: 4291 Re: fdopen: Bad file descriptor « Reply #2 on: August 14, 2007, 06:45:57 pm » Quote from: killerbot on August 14, 2007, 03:43:10 pmDoes anyone else get this on linux : Quoteif g++ -DHAVE_CONFIG_H -I. -I. -I../../src/include -I/usr/lib64/wx/include/gtk2-unicode-release-2.8 -I/usr/i
Login: [x] User account creation filtered due to spam. Bug13675 - #including a precompiled https://gcc.gnu.org/bugzilla/show_bug.cgi?id=13675 header more than once in the same unit fails Summary: #including https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12707 a precompiled header more than once in the same unit fails Status: RESOLVED FIXED Alias: None Product: gcc Classification: Unclassified Component: pch (show other bugs) Version: 3.4.0 Importance: P2 normal Target Milestone: 4.4.0 Assignee: Not yet assigned to anyone URL: Keywords: Duplicates (3): 12707 15118 error calling 24029 (view as bug list) Depends on: Blocks: 12707 Show dependency tree /graph Reported: 2004-01-14 03:10 UTC by jbrandmeyer Modified: 2014-02-16 13:17 UTC (History) CC List: 18 users (show) a.darovskikh bacek ciaran.mccreesh dgp85 gafunchal gcc-bugs gcc-bugzilla jackie.rosen kgardas l.bermes mehturt neil rupert.swarbrick RWGrosse-Kunstleve test.007 tim trevor v13 See Also: Host: i686-pc-linux-gnu Target: i686-pc-linux-gnu Build: i686-pc-linux-gnu error calling fdopen Known to work: Known to fail: 3.4.0 4.1.0 4.0.0 Last reconfirmed: 2005-06-12 20:41:50 Attachments Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description jbrandmeyer 2004-01-14 03:10:18 UTC This has also been observed on powerpc-apple-darwin6.8 with current sources as of 1pm US Eastern time today when configured with ../gcc/configure --enable-languages=c,c++ --program-suffix=-3.4 --enable-version-specific-runtime-libs Both the C and C++ compilers are affected. If a header file is precompiled and #included more than once in the same compilation unit, the second inclusion generates an error like "filename:linenumber:columnnumber calling fdopen: Bad file descriptor" Consider this trivial example: -----------pch-header.h------- #ifndef PCH_HEADER_TEST_H #define PCH_HEADER_TEST_H extern int i; #endif ----------another-pch-user.h------- #include "pch-header.h" ----------pch-user1.cpp------- #include "pch-header.h" #include "another-pch-user.h" ---------------end---------- $ g++-3.4 -c -o pch-header.h.gch pch-header.h $ g++-3.4 -c -o pch-user1.o pch-user1.cpp In file included from pch-user1.cpp:2: another-pch-user.h:1:24: calling fdopen: Bad file descriptor $ g++-3.4 -v Reading specs from /home/jonathan/lib/gcc/i686-pc-linux-gnu/3.4.0/specs Configured with: ../gcc/configure --enable-languages=c,c++ --program-suffix=-3.4 --disable-checking --prefix=/home/jonathan Thread model: posix gcc versio
Forgot Password Login: [x] User account creation filtered due to spam. Bug12707 - Inclusion of PCH file produces "calling fdopen: Bad file descriptor" error Summary: Inclusion of PCH file produces "calling fdopen: Bad file descriptor" error Status: RESOLVED DUPLICATE of bug 13675 Alias: None Product: gcc Classification: Unclassified Component: pch (show other bugs) Version: 3.4.0 Importance: P2 normal Target Milestone: 3.4.1 Assignee: Not yet assigned to anyone URL: Keywords: Depends on: 13675 Blocks: Show dependency tree /graph Reported: 2003-10-21 09:39 UTC by Karel Gardas Modified: 2005-07-23 22:49 UTC (History) CC List: 1 user (show) gcc-bugs See Also: Host: Target: Build: Known to work: Known to fail: Last reconfirmed: Attachments Add an attachment (proposed patch, testcase, etc.) Note You need to log in before you can comment on or make changes to this bug. Description Karel Gardas 2003-10-21 09:39:38 UTC Hi, when I try to use PCH on MICO project, I've got following error when compiling orb/ssliop.cc file: c++ -I../include -DFAST_PCH -Wall -DPIC -fPIC -c ssliop.cc -o ssliop.pic.o In file included from ../include/mico/ssliop.h:38, from ssliop.cc:8: ../include/mico/current.h:8:19: calling fdopen: Bad file descriptor In file included from ../include/mico/ssliop.h:39, from ssliop.cc:8: ../include/mico/service_info.h:8:19: calling fdopen: Bad file descriptor In file included from ../include/mico/ssliop.h:40, from ssliop.cc:8: ../include/mico/ir_base.h:8:19: calling fdopen: Bad file descriptor In file included from ../include/mico/ssliop.h:41, from ssliop.cc:8: ../include/mico/ir.h:8:19: calling fdopen: Bad file descriptor In file included from ../include/mico/ssliop.h:42, from ssliop.cc:8: ../include/mico/policy.h:8:19: calling fdopen: Bad file descriptor In file included from ../include/mico/ssliop.h:43, from ssliop.cc:8: ../include/mico/timebase.h:8:19: calling fdopen: Bad file descriptor In file included from ../include/mico/ssliop.h:44, from ssliop.cc:8: ../include/mico/security/csi_base.h:8:19: calling fdopen: Bad file descriptor In file included from ../include/mico/ssliop.h:45, from ssliop.cc:8: ../include/mico/security/security.h:8:19: calling fdopen: Bad file descriptor make: *** [ssliop.pic.o] Error 1 The problem is that the problematics include files tries to include CORBA.h which is precompiled to the CORBA.h.gch. When I remove CORBA.h.gch, compilation continues well. Analysis: there are a lot of files which include CORBA.h in