c++ - Makefile 'fdopen: Bad file descriptor' error -
i'm making makefile, , getting error:
list.h:10:18: error: calling fdopen: bad file descriptor i have no idea why happens. here's beginning of list.h:
#ifndef list_h__ #define list_h__ #include "data.h" #include "general.h" where #include "data.h" 10th line. data , general order in dependencies written in makefile:
list.o: list.cpp list.h data.h general.h g++ list.cpp $(f) data doesn't include , general includes iostream, , no other class includes iostream.
here's data.h:
#ifndef data_h__ #define data_h__ class data { private: public: //default constructor data() {} //destructor virtual ~data()=0; /***************************************************************************** * function name: operator< * input: data, other data * output: operator compare between 2 datas. comparison * used create sorted list. *****************************************************************************/ virtual bool operator<(const data& other) const =0; }; data::~data() {} #endif //data_h__ i had trivial implementation of data's destructor after =0, , i've tried move trivial implementations of constructor , destructor .cpp file. of above didn't work. please - i've been stuck on makefile hours , it's driving me crazy! thanks!
first, check see if using precompiled headers. if delete precompiled headers.
if doesn't work, think this may help. there bug in version of g++ including header multiple times in single unit.
look @ see if including data.h multiple times.
precompiled headers: .gch files , delete them.
often large projects have many header files included in every source file. time compiler takes process these header files on , on again can account of time required build project. make builds faster, gcc allows users `precompile' header file; then, if builds can use precompiled header file faster.
to create precompiled header file, compile other file, if necessary using -x option make driver treat c or c++ header file. want use tool make keep precompiled header up-to-date when headers contains change.
a precompiled header file searched when #include seen in compilation. searches included file (see search path) compiler looks precompiled header in each directory before looks include file in directory. name searched name specified in #include `.gch' appended. if precompiled header file can't used, ignored.
for instance, if have #include "all.h", , have all.h.gch in same directory all.h, precompiled header file used if possible, , original header used otherwise.
Comments
Post a Comment