5

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?

Brian Webster
  • 30,033
  • 48
  • 152
  • 225
LandonSchropp
  • 10,084
  • 22
  • 86
  • 149
  • 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
  • Source code please? We're not psychic debuggers nor clairvoyants... – t0mm13b Feb 16 '10 at 20:26

2 Answers2

6

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

F'x
  • 12,105
  • 7
  • 71
  • 123
0

Sorry, I just forgot to include the stdio.h header file. I feel kind of stupid now.

Brian Webster
  • 30,033
  • 48
  • 152
  • 225
LandonSchropp
  • 10,084
  • 22
  • 86
  • 149