Bad file descriptor

When trying to compile my code with g++ i get this:

MayaFunctions.h:5:27: error: calling fdopen: Bad file descriptor

in that line, I simply have
#include "AnotherFile.h"

Google told me this has something to do with precompiled headers, but I can't figure out how to turn them off.

1) how to turn off using precompiled headers with g++ flags?
2) what else would be causing this??

Thanks!

Dave
Try reordering the header files. I'm not sure if that will work, but it apparently worked for some test code at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13675

The bug was an issue with precompiled headers being included twice, which may be the case here. The same issue with fdopen() came up in that instance. Perhaps your problem and that bug are related to each other.
I don't check here often so please forgive me if I never respond to any questions or responses...

Solution to my similar problem after reading...

Make sure the includes at the top of your headers and source are always in the same order and make sure the call to G++ is in the same order as listed in the top of the headers and source files.

(Note: I didn't test the different combinations but I did get it to work my first try, this does assume the flexibility of having all sources.)

Heres what I had trouble with

1
2
3
4
5
6
7
8
9
10
11
12
13
// Composition.h
#include Increment.h
#include Time.h

// Composition.cpp
#include "Composition.h"
#include "Time.h"
#include "Increment.h"

// TestComposition.cpp
#include "Time.h"
#include "Increment.h"
#include "Composition.h" 


my original G++ call

 
g++ Increment.cpp Time.cpp Composition.cpp TestComposition.cpp -o TestComp


My solution:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Composition.h (No difference)
#include Increment.h
#include Time.h

// Composition.cpp (Big difference here)
#include "Increment.h"
#include "Time.h"

#include "Composition.h"

// TestComposition.cpp (Minor difference here)
#include "Increment.h"
#include "Time.h"
#include "Composition.h" 


My G++ call stays the same:

 
g++ Increment.cpp Time.cpp Composition.cpp TestComposition.cpp -o TestComp
Topic archived. No new replies allowed.