Compilation using ROOT is failing

Hi

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:


#include “MEnv.h”

#include <TObjString.h>

#include “MLog.h”
#include “MLogManip.h”

ClassImp(MEnv);

using namespace std;

Int_t MEnv::GetValue(const char *name, Int_t dflt)
{
if (!fChecked.FindObject(name))
fChecked.Add(new TObjString(name));
return TEnv::GetValue(name, dflt);
}

Double_t MEnv::GetValue(const char *name, Double_t dflt)
{
if (!fChecked.FindObject(name))
fChecked.Add(new TObjString(name));
return TEnv::GetValue(name, dflt);
}

const char *MEnv::GetValue(const char *name, const char *dflt)
{
if (!fChecked.FindObject(name))
fChecked.Add(new TObjString(name));
return TEnv::GetValue(name, dflt);
}

void MEnv::PrintUntouched() const
{
int i=0;
gLog << inf << flush;
gLog.Separator(“Untouched Resources”);
TIter Next(GetTable()); // line #71
TObject *o=0;
while ((o=Next()))
if (!fChecked.FindObject(o->GetName()))
{
gLog << warn << " - Resource " << o->GetName() << " not
touched" << endl;
i++;
}
if (i==0)
gLog << inf << “None.” << endl;
else
gLog << inf << i << " resources have not been touched." << endl;
}


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

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

Thanks
Mradul
all.tar.gz (108 KB)

Hi tpochep…

There is one point I would like to bring to your attention. During some earlier compilation of another program, I was getting the error


MArgs.cc: In member function TString MArgs::GetStringAndRemove(TString)': MArgs.cc:215: error: conversion fromint’ to `TString’ is ambiguous


After this error, I followed the previous posts of RootTalk ( Severe problem with TString in root_5.24.00) and the problem got rectified.

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=“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.

I’ll check your second question now.

[quote=“mradul”]Hi tpochep…

There is one point I would like to bring to your attention. During some earlier compilation of another program, I was getting the error


MArgs.cc: In member function TString MArgs::GetStringAndRemove(TString)': MArgs.cc:215: error: conversion fromint’ to `TString’ is ambiguous


After this error, I followed the previous posts of RootTalk ( Severe problem with TString in root_5.24.00) and the problem got rectified.

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 ?

Hi…

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


Thanks

[quote=“mradul”]Hi…

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


Thanks[/quote]

Yes, include THashList and good luck!

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=“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?

Philippe.

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

Hi Timur,

Thanks, indeed if had missed the extra ‘f’ :slight_smile:.

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

Cheers,
Philippe.

Dear tpochep, Philippe,

Thanks a lot for your help. I am trying to update to newer MARS version. Will be back to you guys if stuck somewhere.

Mradul

Dear tpochep, Philippe,

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

Thanks again
Mradul