Compatibility problems with Geant4 (UUtils.hh)

Dear ROOT experts,

I am now developing a Geant4 application where I need to use ROOT libraries.

The problem is that when I include my class derived from ROOT libraries (TRestRun.h) inside DetectorConstruction.cc it gives me an error at compilation time.

The problem is that geant4.10.1-install/include/Geant4/UUtils.hh defines an enum with Error, Warning and Info.

This produces a conflict with TError.h from ROOT libraries that defines an extern function Error(…), Warning(…) and Info(…).

I am using
ROOT 5.34/26 (v5-34-26@v5-34-26, Feb 20 2015, 13:23:25 on linuxx8664gcc)

Do you have any advise on how to bypass the problem?

Here it is the error that I get on screen

======================================================

[ 25%] Building CXX object CMakeFiles/G4Rest.dir/src/DetectorConstruction.cc.o
In file included from /usr/local/geant4.10.1-install/include/Geant4/VUSolid.hh:14:0,
from /usr/local/geant4.10.1-install/include/Geant4/G4USolid.hh:42,
from /usr/local/geant4.10.1-install/include/Geant4/G4UMultiUnion.hh:48,
from /usr/local/geant4.10.1-install/include/Geant4/G4MultiUnion.hh:45,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadSolids.hh:46,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadSetup.hh:47,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadParamvol.hh:43,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadStructure.hh:46,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLParser.hh:43,
from /home/javier/svn/new_trunk/restG4/src/DetectorConstruction.cc:28:
/usr/local/geant4.10.1-install/include/Geant4/UUtils.hh:35:38: error: ‘Error’ redeclared as different kind of symbol
{ FatalError, FatalErrorInArguments, Error, Warning, Info };
^
In file included from /usr/local/root/include/TVector3.h:15:0,
from /home/javier/svn/new_trunk/restcore/inc/TRestMetadata.h:33,
from /home/javier/svn/new_trunk/restcore/inc/TRestRun.h:29,
from /home/javier/svn/new_trunk/restG4/include/DetectorConstruction.hh:4,
from /home/javier/svn/new_trunk/restG4/src/DetectorConstruction.cc:2:
/usr/local/root/include/TError.h:70:13: error: previous declaration of ‘void Error(const char*, const char*, …)’
extern void Error(const char location, const char msgfmt, …)
^
In file included from /usr/local/geant4.10.1-install/include/Geant4/VUSolid.hh:14:0,
from /usr/local/geant4.10.1-install/include/Geant4/G4USolid.hh:42,
from /usr/local/geant4.10.1-install/include/Geant4/G4UMultiUnion.hh:48,
from /usr/local/geant4.10.1-install/include/Geant4/G4MultiUnion.hh:45,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadSolids.hh:46,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadSetup.hh:47,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadParamvol.hh:43,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadStructure.hh:46,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLParser.hh:43,
from /home/javier/svn/new_trunk/restG4/src/DetectorConstruction.cc:28:
/usr/local/geant4.10.1-install/include/Geant4/UUtils.hh:35:45: error: ‘Warning’ redeclared as different kind of symbol
{ FatalError, FatalErrorInArguments, Error, Warning, Info };
^
In file included from /usr/local/root/include/TVector3.h:15:0,
from /home/javier/svn/new_trunk/restcore/inc/TRestMetadata.h:33,
from /home/javier/svn/new_trunk/restcore/inc/TRestRun.h:29,
from /home/javier/svn/new_trunk/restG4/include/DetectorConstruction.hh:4,
from /home/javier/svn/new_trunk/restG4/src/DetectorConstruction.cc:2:
/usr/local/root/include/TError.h:65:13: error: previous declaration of ‘void Warning(const char
, const char
, …)’
extern void Warning(const char location, const char msgfmt, …)
^
In file included from /usr/local/geant4.10.1-install/include/Geant4/VUSolid.hh:14:0,
from /usr/local/geant4.10.1-install/include/Geant4/G4USolid.hh:42,
from /usr/local/geant4.10.1-install/include/Geant4/G4UMultiUnion.hh:48,
from /usr/local/geant4.10.1-install/include/Geant4/G4MultiUnion.hh:45,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadSolids.hh:46,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadSetup.hh:47,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadParamvol.hh:43,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLReadStructure.hh:46,
from /usr/local/geant4.10.1-install/include/Geant4/G4GDMLParser.hh:43,
from /home/javier/svn/new_trunk/restG4/src/DetectorConstruction.cc:28:
/usr/local/geant4.10.1-install/include/Geant4/UUtils.hh:35:54: error: ‘Info’ redeclared as different kind of symbol
{ FatalError, FatalErrorInArguments, Error, Warning, Info };
^
In file included from /usr/local/root/include/TVector3.h:15:0,
from /home/javier/svn/new_trunk/restcore/inc/TRestMetadata.h:33,
from /home/javier/svn/new_trunk/restcore/inc/TRestRun.h:29,
from /home/javier/svn/new_trunk/restG4/include/DetectorConstruction.hh:4,
from /home/javier/svn/new_trunk/restG4/src/DetectorConstruction.cc:2:
/usr/local/root/include/TError.h:60:13: error: previous declaration of ‘void Info(const char
, const char
, …)’
extern void Info(const char *location, const char *msgfmt, …)
^
make[2]: *** [CMakeFiles/G4Rest.dir/src/DetectorConstruction.cc.o] Error 1
make[1]: *** [CMakeFiles/G4Rest.dir/all] Error 2
make: *** [all] Error 2

==========================

any help is welcome,
thanks you,
Javier

Try to switch to “geant4.10.01.p02” (they renamed these enums).

Yes, that solved the problem,

thanks!