Latest bunch of root header syntax errors sill showing up

Hello everyone,

I have been tweaking with my system to get the c++ version sorted out, between Geant4 and root. Looks like that is sorted out, but the error messages that I first saw with root are still present: these can be narrowed down to:
home/neera/root/include/Rtypes.h:275:11: error: ‘R__likely’ was not declared in this scope
if (R__likely(recurseBlocker >= 2)) {

/home/neera/root/include/Rtypes.h:281:67: error: expected primary-expression before ‘)’ token
::ROOT::Internal::HasConsistentHashMember(QUOTE(name)) ||
^
/home/neera/root/include/Rtypes.h:281:55: error: ‘QUOTE’ was not declared in this scope
::ROOT::Internal::HasConsistentHashMember(QUOTE(name)) ||
^
/home/neera/root/include/TTree.h:685:33: error: ‘SafeDelete’ was not declared in this scope
void Reset() { SafeDelete(fLeafIter); SafeDelete(fTreeIter); }
^~~~~~~~~~

/home/neera/root/include/TClass.h:391:59: error: ‘TestBit’ was not declared in this scope
Bool_t CanIgnoreTObjectStreamer() { return TestBit(kIgnoreTObjectStreamer);}

/home/neera/root/include/TStorage.h:118:1: error: ‘R__INTENTIONALLY_UNINIT_BEGIN’ was not declared in this scope

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/neera/root/include/TStorage.h:120:1: error: ‘R__INTENTIONALLY_UNINIT_END’ was not declared in this scope

^~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/neera/root/include/TStorage.h:131:1: error: ‘R__NEVER_INLINE’ does not name a type; did you mean ‘__MATH_INLINE’?
R__NEVER_INLINE void TStorage::UpdateIsOnHeap(volatile const UInt_t &uniqueID, volatile UInt_t &bits) {
^~~~~~~~~~~~~~~

/home/neera/root/include/TObject.h:152:4: error: ‘R__ALWAYS_INLINE’ does not name a type; did you mean ‘__MATH_INLINE’?

/home/neera/root/include/TObject.h:178:42: error: ‘TestBit’ was not declared in this scope
Bool_t IsDestructed() const { return !TestBit(kNotDeleted); }
^~~~~~~
/home/neera/root/include/TObject.h:178:42: note: suggested alternative: ‘TestBits’
Bool_t IsDestructed() const { return !TestBit(kNotDeleted); }
^~~~~~~
TestBits

/home/neera/root/include/TObject.h:302:11: error: ‘IsOnHeap’ was not declared in this scope
if (IsOnHeap()) { // test uses fBits so don’t move next line
^~~~~~~~
/home/neera/root/include/TObject.h:302:11: note: suggested alternative: ‘kIsOnHeap’
if (IsOnHeap()) { // test uses fBits so don’t move next line
^~~~~~~~
kIsOnHeap

Most likely a wrong header file is being inadvertently used. Do (assuming you use make)

make VERBOSE=true |& tee make.01.log

Towards the end it will says that some file name end in .o failed to compiled (because of the error above). Then do:

grep thatfilename.o make.01.log

there will be compile line that we need to tweaks in that line replace the -c with -E and rename the file after the -o to change the extension from .o to .E (and remove any command option starting in -M ). Once you are done, upload the .E file here.

Good afternoon,

This is what I get:

src/EventAction.cc: In member function ‘virtual void EventAction::EndOfEventAction(const G4Event*)’:
src/EventAction.cc:105:12: warning: unused variable ‘momentum’ [-Wunused-variable]
G4double momentum = pp->GetMomentum().mag()/GeV;
^~~~~~~~
src/EventAction.cc:107:12: warning: unused variable ‘mass’ [-Wunused-variable]
G4double mass = pp->GetMass();
^~~~
make: *** [/opt/geant4/geant4.10.04.p02/config/common.gmk:80: /home/neera/geant4_workdir/tmp/Linux-g++/west/EventAction.o] Error 1
[neera@vm-nii-fc27-a ~/xraywest]$ grep EventAction.o make.01.log

make: *** [/opt/geant4/geant4.10.04.p02/config/common.gmk:80: /home/neera/geant4_workdir/tmp/Linux-g++/west/EventAction.o] Error 1
[neera@vm-nii-fc27-a ~/xraywest]$
make.01.log.txt (103.4 KB)

Try with:

make VERBOSE=1 V=1 CPPVERBOSE=1 --debug=j,p |& tee make.01.log

In my Geant4 codes, there is a G4 header RunAction.hh, which calls TFile.h (a root header) on line 39, just as it says in the error log.

Also, in EventAction.cc, like 37 calls RunAction.hh, so the error is in the TFile.h, a root header, which calls other headers. The problem appears to be in:
TObject.h
TStorage.h
Rtypes.h
TString.h
TCollelction.h
TClass.h
TFile.h
TTree.h
I just did a search for 'error" in my file and it showed an error in these header files, specifying exactly what the error is, multiple times. When I get back to work tomorrow, I shall try and debug these files based on the syntaxes i have received in them. But this is something everyone can do as these are all root header files.

But this is something everyone can do as these are all root header files.

They are not the problem. They only fail in your environment because there is (very likely) a stray installation or file that in interfering. The easiest way to figure this out is to just run the C++ macro preprocessor on your file in your environment. For that you need to follow the instruction Wile and I sent exactly and send us the completely result. You can then tell you the command to use (i.e. using the -E to get to the bottom of the problem).

I followed your command and gave you the output, didn’t I? I am not sure if I understand the -E command, so need some guidance there.

I carried out Wile’s command, and got this error:

[neera@vm-nii-fc27-a ~/xraywest]$ make VERBOSE=1 V=1 CPPVERBOSE=1 --debug=j,p | & tee make.02.log.txt

make: *** unknown debug level specification ‘p’. Stop.

[neera@vm-nii-fc27-a ~/xraywest]$

So, remove “,p” from this command line.

Did, and this is the file
make.02.log.txt (115.0 KB)

cmd01.txt (11.4 KB)
Execute the attached file

. cmd01.txt

and send us the resutling file /home/neera/geant4_workdir/tmp/Linux-g++/west/EventAction.E

Note that you log also contains:

mkdir: cannot create directory ‘/opt/geant4/geant4.10.04.p02/this_is_a_deliberate_dummy_path’: Permission denied

(which is likely unrelated to the problem we are addressing here but might still be indicative of another misconfiguration)

EventAction.txt (2.5 MB)

I had to rename the file from.E to .txt as my system will not allow me to upload unknown extensions. it is the same file you asked from taken from the same location that you indicated. Thanks.

Yes, I can see that, but will address it later. let us debug the errors first. thanks for your help

You seem to mix Geant4, which uses “-std=c++11” with ROOT, which uses"-std=c++14".
Moreover, it seems that you try to use Geant4 include files from its “/opt/geant4/geant4.10.04.p02/source/” directory. You should use the “include” directory present where Geant4 binaries have been installed (after building).

I had (earlier) run the command you gave me to make my Geant4 C++14 aware, but that did not work, it seems

I have downloaded a new version of Geant4, which is a tar file. normally I untar it using

tar -xvzf geant4*.tar.gz

then use cmake, which builds from source. What command do I give to build it from binaries?

In general, a final “make install” should do the job.

See the Geant4 version-specific “Installation Guide” (and other guides) in: Geant4 → User Documentation

The R_likely problem is technically coming from this sequence:

# 1 "/home/neera/root/include/RtypesCore.h" 1
# 23 "/home/neera/root/include/RtypesCore.h"
# 1 "include/ROOT/RConfig.hxx" 1
# 23 "include/ROOT/RConfig.hxx"
# 1 "/home/neera/root/include/RConfig.hxx" 1
# 24 "include/ROOT/RConfig.hxx" 2
# 24 "/home/neera/root/include/RtypesCore.h" 2

It is not quite clear how the file "include/ROOT/RConfig.hxx" interfers but it is not expected.

I believe there is no file with the extension .hxx - that is how it interferes. I need copy and save RConfig.h to RConfig.hxx. then that problem will be gone.

Also “/home/neera/root/include/RConfig.hxx” is not expected.
There should be “/home/neera/root/include/ROOT/RConfig.hxx”.
Can it be that the ROOT binary installation is broken / incomplete?