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.)