Message: Compatibility problems with ROOT libraries TError.h Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

Warning Compatibility problems with ROOT libraries TError.h 

Forum: User Requirements
Date: 04 Jul, 2015
From: Javier Galan <Javier Galan>

Dear Geant4 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(...).

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

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

 Add Message Add Message
to: "Compatibility problems with ROOT libraries TError.h"

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews


[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]