I am using (ROOT 5.30/01). While compiling a file (MEnv.cc) , I got the following error message:
Error message
Compiling MEnv.cc
cc1plus: warning: command line option “-Wstrict-prototypes” is valid for C/ObjC but not for C++
cc1plus: warning: command line option “-Wmissing-prototypes” is valid for C/ObjC but not for C++ MEnv.cc: In member function void MEnv::PrintUntouched() const': MEnv.cc:71: error: no matching function for call toTIter::TIter(THashList*)’
/usr/local/root/include/TCollection.h:150: note: candidates are: TIter::TIter(const TIter&)
/usr/local/root/include/TCollection.h:149: note: TIter::TIter(TIterator*)
/usr/local/root/include/TCollection.h:148: note: TIter::TIter(const TCollection*, Bool_t)
/usr/local/root/include/TCollection.h:144: note: TIter::TIter()
make[1]: *** [MEnv.o] Error 1
make: *** [mbase.a] Error 2
Please suggest the remedy.
Regards
Mradul
File (MEnv.cc) for compilation for which error is mentioned above:
Where is at least 'GetTable’s declaration? If you have some compilation errors, you have to provide code, which is enough to reproduce your problem.
From fragments you gave us I can only guess that in a file, which contains statement
you did not include THashList.h (neither direct, nor indirect inclusion). THashList derives TList, which derives TSeqCollection, which derives TCollection, and TIter has constructor for const TCollection *. So if compiler complains about such a call, this is probably due to THashList is an ‘incomplete’ type in the place you have an error.
Hi…
I am attaching a part of the program which is producing similar error, the one written in the last message. ( I am not able to attach the entire code as it is quite big in size, but the attached part produces the same error).
The error while compiling:
Makefile.rules:1: BaseDep.d: No such file or directory
Generating dependencies BaseDep.d
Compiling MLogo.cc
cc1plus: warning: command line option “-Wstrict-prototypes” is valid for C/ObjC but not for C++
cc1plus: warning: command line option “-Wmissing-prototypes” is valid for C/ObjC but not for C++
Compiling MArgs.cc
cc1plus: warning: command line option “-Wstrict-prototypes” is valid for C/ObjC but not for C++
cc1plus: warning: command line option “-Wmissing-prototypes” is valid for C/ObjC but not for C++
Compiling MString.cc
cc1plus: warning: command line option “-Wstrict-prototypes” is valid for C/ObjC but not for C++
cc1plus: warning: command line option “-Wmissing-prototypes” is valid for C/ObjC but not for C++
Compiling MMath.cc
cc1plus: warning: command line option “-Wstrict-prototypes” is valid for C/ObjC but not for C++
cc1plus: warning: command line option “-Wmissing-prototypes” is valid for C/ObjC but not for C++
Compiling MEnv.cc
cc1plus: warning: command line option “-Wstrict-prototypes” is valid for C/ObjC but not for C++
cc1plus: warning: command line option “-Wmissing-prototypes” is valid for C/ObjC but not for C++
MEnv.cc: In member function void MEnv::PrintUntouched() const': MEnv.cc:47: error: no matching function for call toTIter::TIter(THashList*)’
/usr/local/root/include/TCollection.h:150: note: candidates are: TIter::TIter(const TIter&)
/usr/local/root/include/TCollection.h:149: note: TIter::TIter(TIterator*)
/usr/local/root/include/TCollection.h:148: note: TIter::TIter(const TCollection*, Bool_t)
/usr/local/root/include/TCollection.h:144: note: TIter::TIter()
The entire program along with the makefile is attached with this message.
[quote=“mradul”]Hi…
I am attaching a part of the program which is producing similar error, the one written in the last message. ( I am not able to attach the entire code as it is quite big in size, but the attached part produces the same error).
[/quote]
Hi.
As I told you, THashList has incomplete type in TIter iter(GetTable()); now I can see, that GetTable() is a member-function in TEnv, it returns THashList, and in TEnv.h there is only forward declaration of THashList. So, as I told you already - include THashList.h in MEnv.cc to resolve this problem.
Now the present compilation problem is giving me some error. Do you think that this problem (last post) is a ROOT version related problem?
Thanks
Mradul[/quote]
Hi, your Makefile does not work for me, so I can not even check what errors you have. File MArgs.cc as it is - can be compiled, if your error is in
return TString(0);
this should work, since TString has ctor ‘explicit TString(Ssiz_t)’ //Ssiz_t == int and literal 0 - has type int.
What’s you ROOT/compiler’s versions and what is exact error message ?
In the “Makefile”, I have not defined the OS type (In the Makefile , I have “include Makefile.conf.$(OSTYPE)” )
Before “make” , I export the OSTYPE as linux ( > export OSTYPE=linux). You please export your OS. It should compile now.
I am using ROOT version 5.30/01.
Error while “make” is :
Compiling MEnv.cc
cc1plus: warning: command line option “-Wstrict-prototypes” is valid for C/ObjC but not for C++
cc1plus: warning: command line option “-Wmissing-prototypes” is valid for C/ObjC but not for C++ MEnv.cc: In member function void MEnv::PrintUntouched() const': MEnv.cc:47: error: no matching function for call toTIter::TIter(THashList*)’
/usr/local/root-5.30_1/include/TCollection.h:150: note: candidates are: TIter::TIter(const TIter&)
/usr/local/root-5.30_1/include/TCollection.h:149: note: TIter::TIter(TIterator*)
/usr/local/root-5.30_1/include/TCollection.h:148: note: TIter::TIter(const TCollection*, Bool_t)
/usr/local/root-5.30_1/include/TCollection.h:144: note: TIter::TIter()
make: *** [MEnv.o] Error 1
In the “Makefile”, I have not defined the OS type (In the Makefile , I have “include Makefile.conf.$(OSTYPE)” )
Before “make” , I export the OSTYPE as linux ( > export OSTYPE=linux). You please export your OS. It should compile now.
I am using ROOT version 5.30/01.
Error while “make” is :
Compiling MEnv.cc
cc1plus: warning: command line option “-Wstrict-prototypes” is valid for C/ObjC but not for C++
cc1plus: warning: command line option “-Wmissing-prototypes” is valid for C/ObjC but not for C++ MEnv.cc: In member function void MEnv::PrintUntouched() const': MEnv.cc:47: error: no matching function for call toTIter::TIter(THashList*)’
/usr/local/root-5.30_1/include/TCollection.h:150: note: candidates are: TIter::TIter(const TIter&)
/usr/local/root-5.30_1/include/TCollection.h:149: note: TIter::TIter(TIterator*)
/usr/local/root-5.30_1/include/TCollection.h:148: note: TIter::TIter(const TCollection*, Bool_t)
/usr/local/root-5.30_1/include/TCollection.h:144: note: TIter::TIter()
make: *** [MEnv.o] Error 1
hi…
The problem got rectified by including THashList.h. Now a new set of errors have appeared.
Errors:
In file included from MLog.cc:85:
/usr/local/root-5.30_1/include/TObject.h:148: warning: virtual void TObject::SavePrimitive(std::ostream&, const Option_t*)' was hidden MParContainer.h:96: warning: byvirtual void MParContainer::SavePrimitive(std::ofstream&, const Option_t*)‘ MLog.cc: In member function void MLog::Underline()': MLog.cc:238: error: 'class TList' has no member named 'ForEach' MLog.cc:238: error: expected primary-expression before ',' token MLog.cc: In member functionvoid MLog::WriteBuffer()’: MLog.cc:327: error: ‘class TList’ has no member named ‘ForEach’ MLog.cc:327: error: expected primary-expression before ‘,’ token MLog.cc:327: error: `SetColor’ undeclared (first use this function) MLog.cc:327: error: (Each undeclared identifier is reported only once for each function it appears in.) MLog.cc:328: error: ‘class TList’ has no member named 'ForEach’ MLog.cc:328: error: expected primary-expression before ‘,’ token
make: *** [MLog.o] Error 1
[quote=“mradul”]hi…
The problem got rectified by including THashList.h. Now a new set of errors have appeared.
Errors:
In file included from MLog.cc:85:
/usr/local/root-5.30_1/include/TObject.h:148: warning: virtual void TObject::SavePrimitive(std::ostream&, const Option_t*)' was hidden MParContainer.h:96: warning: byvirtual void MParContainer::SavePrimitive(std::ofstream&, const Option_t*)‘ MLog.cc: In member function void MLog::Underline()': MLog.cc:238: error: 'class TList' has no member named 'ForEach' MLog.cc:238: error: expected primary-expression before ',' token MLog.cc: In member functionvoid MLog::WriteBuffer()’: MLog.cc:327: error: ‘class TList’ has no member named ‘ForEach’ MLog.cc:327: error: expected primary-expression before ‘,’ token MLog.cc:327: error: `SetColor’ undeclared (first use this function) MLog.cc:327: error: (Each undeclared identifier is reported only once for each function it appears in.) MLog.cc:328: error: ‘class TList’ has no member named 'ForEach’ MLog.cc:328: error: expected primary-expression before ‘,’ token
make: *** [MLog.o] Error 1
Thanks
Mradul[/quote]
Is this your code? Where did you find this ForEach ?
[quote]/usr/local/root-5.30_1/include/TObject.h:148: warning: virtual void TObject::SavePrimitive(std::ostream&, const Option_t*)' was hidden MParContainer.h:96: warning: byvirtual void MParContainer::SavePrimitive(std::ofstream&, const Option_t*)’[/quote]is a bit odd. What is the complete declaration of MParContainer?
[quote=“pcanal”][quote]/usr/local/root-5.30_1/include/TObject.h:148: warning: virtual void TObject::SavePrimitive(std::ostream&, const Option_t*)' was hidden MParContainer.h:96: warning: byvirtual void MParContainer::SavePrimitive(std::ofstream&, const Option_t*)’[/quote]is a bit odd. What is the complete declaration of MParContainer?
Philippe.[/quote]
Hi Philippe.
He has attached a tar with full source code. Declaration is :
the first parameter’s type is different from TObject’s declaration, that’s why he has this warning.
What is strange, that he’s using some ‘ForEach’ - the person who wrote this code should know, what does it mean.
[quote=“mradul”]hi…
The problem got rectified by including THashList.h. Now a new set of errors have appeared.
Errors:
In file included from MLog.cc:85:
/usr/local/root-5.30_1/include/TObject.h:148: warning: virtual void TObject::SavePrimitive(std::ostream&, const Option_t*)' was hidden MParContainer.h:96: warning: byvirtual void MParContainer::SavePrimitive(std::ofstream&, const Option_t*)‘ MLog.cc: In member function void MLog::Underline()': MLog.cc:238: error: 'class TList' has no member named 'ForEach' MLog.cc:238: error: expected primary-expression before ',' token MLog.cc: In member functionvoid MLog::WriteBuffer()’: MLog.cc:327: error: ‘class TList’ has no member named ‘ForEach’ MLog.cc:327: error: expected primary-expression before ‘,’ token MLog.cc:327: error: `SetColor’ undeclared (first use this function) MLog.cc:327: error: (Each undeclared identifier is reported only once for each function it appears in.) MLog.cc:328: error: ‘class TList’ has no member named 'ForEach’ MLog.cc:328: error: expected primary-expression before ‘,’ token
make: *** [MLog.o] Error 1
Thanks
Mradul[/quote]
Ok, I see now. Either update a version of MARS you are using (in a more recent version there is R__FOR_EACH name instead of ForEach astro.uni-wuerzburg.de/viewc … iew=markup), or install ancient version of ROOT (3.x.x), or modify code yourself, by replacing each of ForEach identifier by R__FOR_EACH.
Mradul, you consider using the signature virtual void TObject::SavePrimitive(std::ostream&, const Option_t*)in order to avoid possible complications (like your routine not being called by code using the TObject interface).
Thanks for your suggestion of updating the MARS version. I could compile it using the latest ROOT (Version 5.32/00) on Suse 12.1 (though on Ubuntu 11.10, it still fails).