Compiling in preuild ROOT in fedora 24 gives strange errors

Dear Co-Rooters,

I am facing a rather strange issue. I am trying to compile a macro that is the following

#include <TSystem.h>
#include <TH1.h>
#include <TFile.h>
#include <fstream>
#include <iostream>
#include <iomanip>// std::setprecision
#include <stdio.h>
#include "Riostream.h"

using namespace std;
using std::cout;
using std::endl;

void fluka2root(char * filename){

	unsigned int zero_counter = 0;
	TString file(filename);
	cout << "Input file  : " << file << endl;
	cout << "Executing awk..." << endl;
	gSystem->Exec(TString::Format("awk 'flag{print;flag=0}/Event #/{flag=1}' %s_fort.21 > %s_out.dat",file.Data(), file.Data()));
	cout << "Output file : " << TString::Format("%s_out.dat", file.Data()) << endl;
	std::ifstream input(TString::Format("%s_out.dat",file.Data()));
	std::vector<float> floats;
	float value;
	//Check if the float was successfully read from the file
	cout << "Filling vector..." << endl;
	while(input >> value){
		// store it in the vector.
		floats.push_back(value);
	}
	TH1F* h = new TH1F("h","Energy Deposition;Energy (MeV); Counts",1000,0,2e2);
	cout << "Filling histogram..." << endl;cout << floats.size()-1 << endl;
	for (unsigned int i = 0; i <= floats.size()-1; i++){//cout << i << " ";
		h->Fill(floats[i]*1000);
		if (floats[i] == 0) zero_counter++;
	}
	cout << "Drawing histogram..." << endl;
	h->Draw("histosame");
	cout << "Found " << zero_counter << "/" << floats.size() << " zero entries" << endl;
	cout << std::setprecision(12) << "Efficiency = " << 100*(floats.size()-zero_counter)/floats.size() << "%" << endl;
	printf("Efficiency = %f % \n",100.*(floats.size()-zero_counter)/floats.size());
	TFile *f = new TFile(TString::Format("fluka.root"),"RECREATE");
	cout << "Saving File " << f->GetName() << endl;
	//TFile f(TString::Format("fluka_%s.root",file.Data()),"RECREATE");
	h->Write();
	f.Close();
}

The compilation was successful in a previous build of root 5.34 under ubuntu 14.04. At the moment I am running fedora 24, so instead of building root, I downloaded the already compiled version for fedora 24 (a few months ago)

When I try to load and compile the macro using .L fluka2root.C++ I get the following strange errors

root [5] .L ../fluka2root.C++
Info in <ACLiC>: script has already been loaded in interpreted mode
Info in <ACLiC>: unloading /home/astamato/Documents/240Pu/FLUKA/efficiency_FIMG/./../fluka2root.C and compiling it
Info in <TUnixSystem::ACLiC>: creating shared library /home/astamato/Documents/240Pu/FLUKA/efficiency_FIMG/./../fluka2root_C.so
Error: class,struct,union or type decltype(nullptr) not defined  /usr/include/c++/6.3.1/x86_64-redhat-linux/bits/c++config.h:2112:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:162:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:162:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:163:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:163:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:164:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:165:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:166:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:166:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:181:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:198:
Error: Symbol bool is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Error: Function alignof(bool) is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Error: Invalid type 'constexpr' in declaration of 'int _S_alignment' /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Syntax error /usr/include/c++/6.3.1/bits/atomic_base.h:246:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:246:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:249:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:249:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:250:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:250:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:251:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:252:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:253:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:253:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:380:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:401:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:420:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:462:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:506:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:519:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:529:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:539:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:549:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:559:
Error: abstract class object '__atomic_base<bool> _M_base' declared /usr/include/c++/6.3.1/atomic:61:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:64:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/atomic:64:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:65:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/atomic:65:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:66:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:67:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:68:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:68:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:98:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:106:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:115:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:135:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:155:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 13629.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:13629:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 13629.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:13629:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 13629.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:13629:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 13629.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:13629:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 13629.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:13629:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 13629.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:13629:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 13629.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:13629:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 13629.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:13629:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 13629.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:13629:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 13629.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:13629:
Error: Unexpected end of file (G__fgetc()) /usr/include/c++/6.3.1/atomic:13629:
Error in <ACLiC>: Dictionary generation failed!
Info in <ACLiC>: Invoking compiler to check macro's validity
/home/astamato/Documents/240Pu/FLUKA/efficiency_FIMG/./../fluka2root.C: In function ‘void fluka2root(char*)’:
/home/astamato/Documents/240Pu/FLUKA/efficiency_FIMG/./../fluka2root.C:61:4: error: request for member ‘Close’ in ‘f’, which is of pointer type ‘TFile*’ (maybe you meant to use ‘->’ ?)
  f.Close();
    ^~~~~

To be honest I have no clue on what is the matter! Any idea on what is going on and how it can be solved?

Thanks in advance!

It looks like you are ending up parsing C++11 code with CINT (i.e. the interpreter in ROOT v5). This can not work. To support C++11 we switch the intepreter in v6 to be Cling (based on Clang).

In order to work around this, either compile in C++98 mode or hide (from CINT) the headers (#ifndef CINT_) …

Better yet, consider swtich to v6.08.

Cheers,
Philippe.

Thank you very much for your reply!

I don’t know how to compile in C++98 mode! Can you help me in that?

Also if I change my header like this

#ifndef _CINT__

#include <TSystem.h>
#include <TH1.h>
#include <TF1.h>
#include <TFile.h>
#include <fstream>
#include <iostream>
#include <iomanip>// std::setprecision
#include <stdio.h>
#include "Riostream.h"
#include <TString.h>
#include <TMath.h>

#endif

I get the following error

type root [16] .L gaussConvolution.C++
Info in <TUnixSystem::ACLiC>: creating shared library /home/astamato/Documents/240Pu/FLUKA/efficiency_FIMG/./gaussConvolution_C.so
Error: class,struct,union or type decltype(nullptr) not defined  /usr/include/c++/6.3.1/x86_64-redhat-linux/bits/c++config.h:2112:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:162:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:162:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:163:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:163:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:164:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:165:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:166:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:166:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:181:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:198:
Error: Symbol bool is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Error: Function alignof(bool) is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Error: Invalid type 'constexpr' in declaration of 'int _S_alignment' /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Syntax error /usr/include/c++/6.3.1/bits/atomic_base.h:246:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:246:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:249:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:249:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:250:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:250:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:251:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:252:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:253:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:253:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:380:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:401:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:420:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:462:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:506:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:519:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:529:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:539:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:549:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:559:
Error: abstract class object '__atomic_base<bool> _M_base' declared /usr/include/c++/6.3.1/atomic:61:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:64:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/atomic:64:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:65:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/atomic:65:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:66:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:67:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:68:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:68:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:98:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:106:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:115:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:135:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:155:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17827.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17827:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17827.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17827:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17827.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17827:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17827.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17827:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17827.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17827:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17827.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17827:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17827.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17827:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17827.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17827:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17827.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17827:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17827.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17827:
Error: Unexpected end of file (G__fgetc()) /usr/include/c++/6.3.1/atomic:17827:
Error in <ACLiC>: Dictionary generation failed!
Info in <ACLiC>: Invoking compiler to check macro's validity
/home/astamato/Documents/240Pu/FLUKA/efficiency_FIMG/./gaussConvolution.C: In function ‘void gaussConvolution(char*, char*, char*, double, double, double, double, int, double)’:
/home/astamato/Documents/240Pu/FLUKA/efficiency_FIMG/./gaussConvolution.C:132:4: error: ‘contents’ was not declared in this scope
    contents = 0.;
    ^~~~~~~~

Any idea?

I made a typo in the macro name and you can hide all headers. Try:

#include <TSystem.h>
#include <TH1.h>
#include <TF1.h>
#include <TFile.h>
#include "Riostream.h"
#include <TString.h>
#include <TMath.h>

#ifndef __CINT__

#include <fstream>
#include <iostream>
#include <iomanip>// std::setprecision
#include <stdio.h>

#endif

I tried exactly that

#include <TSystem.h>
#include <TH1.h>
#include <TF1.h>
#include <TFile.h>
#include "Riostream.h"
#include <TString.h>
#include <TMath.h>

#ifndef __CINT__

#include <fstream>
#include <iostream>
#include <iomanip>// std::setprecision
#include <stdio.h>

#endif

using namespace std;
using std::cout;
using std::endl;

and that as well

#include <TSystem.h>
#include <TH1.h>
#include <TF1.h>
#include <TFile.h>
#include "Riostream.h"
#include <TString.h>
#include <TMath.h>

#ifndef __CINT__

#include <fstream>
#include <iostream>
#include <iomanip>// std::setprecision
#include <stdio.h>


using namespace std;
using std::cout;
using std::endl;

#endif

but I still get the same error!

type or Info in <TUnixSystem::ACLiC>: creating shared library /home/astamato/Documents/240Pu/FLUKA/efficiency_FIMG/./gaussConvolution_C.so
Error: class,struct,union or type decltype(nullptr) not defined  /usr/include/c++/6.3.1/x86_64-redhat-linux/bits/c++config.h:2112:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:162:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:162:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:163:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:163:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:164:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:165:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:166:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:166:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:181:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:198:
Error: Symbol bool is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Error: Function alignof(bool) is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Error: Invalid type 'constexpr' in declaration of 'int _S_alignment' /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Syntax error /usr/include/c++/6.3.1/bits/atomic_base.h:246:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:246:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:249:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:249:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:250:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:250:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:251:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:252:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:253:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:253:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:380:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:401:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:420:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:462:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:506:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:519:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:529:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:539:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:549:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:559:
Error: abstract class object '__atomic_base<bool> _M_base' declared /usr/include/c++/6.3.1/atomic:61:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:64:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/atomic:64:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:65:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/atomic:65:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:66:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:67:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:68:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:68:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:98:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:106:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:115:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:135:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:155:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17603.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17603:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17603.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17603:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17603.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17603:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17603.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17603:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17603.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17603:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17603.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17603:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17603.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17603:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17603.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17603:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17603.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17603:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 17603.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:17603:
Error: Unexpected end of file (G__fgetc()) /usr/include/c++/6.3.1/atomic:17603:
Error in <ACLiC>: Dictionary generation failed!
Info in <ACLiC>: Invoking compiler to check macro's validity

Maybe I am missing something?

For some reason I cannot reply…

I tried the last suggestion but it is still not working…

I did that but it is till not working…

root [4] .L fluka2root.C++
Info in <TUnixSystem::ACLiC>: creating shared library /home/astamato/Documents/234U/FLUKA/TripleSource/./fluka2root_C.so
Error: class,struct,union or type decltype(nullptr) not defined  /usr/include/c++/6.3.1/x86_64-redhat-linux/bits/c++config.h:2112:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:162:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:162:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:163:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:163:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:164:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:165:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:166:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:166:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:181:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:198:
Error: Symbol bool is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Error: Function alignof(bool) is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Error: Invalid type 'constexpr' in declaration of 'int _S_alignment' /usr/include/c++/6.3.1/bits/atomic_base.h:244:
Syntax error /usr/include/c++/6.3.1/bits/atomic_base.h:246:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:246:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:249:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:249:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:250:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:250:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:251:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:252:
Error: unrecognized language construct /usr/include/c++/6.3.1/bits/atomic_base.h:253:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/bits/atomic_base.h:253:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:380:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:401:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:420:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:462:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:506:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:519:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:529:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:539:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:549:
Error: Redefinition of default argument /usr/include/c++/6.3.1/bits/atomic_base.h:559:
Error: abstract class object '__atomic_base<bool> _M_base' declared /usr/include/c++/6.3.1/atomic:61:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:64:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/atomic:64:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:65:
Error: Symbol default is not defined in current scope  /usr/include/c++/6.3.1/atomic:65:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:66:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:67:
Error: unrecognized language construct /usr/include/c++/6.3.1/atomic:68:
Error: Symbol delete is not defined in current scope  /usr/include/c++/6.3.1/atomic:68:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:98:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:106:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:115:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:135:
Error: Redefinition of default argument /usr/include/c++/6.3.1/atomic:155:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 5015.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:5015:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 5015.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:5015:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 5015.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:5015:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 5015.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:5015:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 5015.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:5015:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 5015.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:5015:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 5015.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:5015:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 5015.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:5015:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 5015.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:5015:
Error: Missing one of ' 	
;:=+-)(*&^%$#@!~'"\|][}{/?.>,<' expected at or after line 5015.
Error: Unexpected end of file (G__fgetstream():2) /usr/include/c++/6.3.1/atomic:5015:
Error: Unexpected end of file (G__fgetc()) /usr/include/c++/6.3.1/atomic:5015:
Error in <ACLiC>: Dictionary generation failed!
Info in <ACLiC>: Invoking compiler to check macro's validity
/home/astamato/Documents/234U/FLUKA/TripleSource/./fluka2root.C: In function ‘void fluka2root(char*)’:
/home/astamato/Documents/234U/FLUKA/TripleSource/./fluka2root.C:50:4: error: request for member ‘Close’ in ‘f’, which is of pointer type ‘TFile*’ (maybe you meant to use ‘->’ ?)
  f.Close();
    ^~~~~

Any idea?

Let’s try the following

#ifdef __CINT__
void fluka2root(char * filename);
#else

#include <TSystem.h>
#include <TH1.h>
#include <TFile.h>
#include <fstream>
#include <iostream>
#include <iomanip>// std::setprecision
#include <stdio.h>
#include "Riostream.h"

using namespace std;
using std::cout;
using std::endl;

void fluka2root(char * filename){

	unsigned int zero_counter = 0;
	TString file(filename);
	cout << "Input file  : " << file << endl;
	cout << "Executing awk..." << endl;
	gSystem->Exec(TString::Format("awk 'flag{print;flag=0}/Event #/{flag=1}' %s_fort.21 > %s_out.dat",file.Data(), file.Data()));
	cout << "Output file : " << TString::Format("%s_out.dat", file.Data()) << endl;
	std::ifstream input(TString::Format("%s_out.dat",file.Data()));
	std::vector<float> floats;
	float value;
	//Check if the float was successfully read from the file
	cout << "Filling vector..." << endl;
	while(input >> value){
		// store it in the vector.
		floats.push_back(value);
	}
	TH1F* h = new TH1F("h","Energy Deposition;Energy (MeV); Counts",1000,0,2e2);
	cout << "Filling histogram..." << endl;cout << floats.size()-1 << endl;
	for (unsigned int i = 0; i <= floats.size()-1; i++){//cout << i << " ";
		h->Fill(floats[i]*1000);
		if (floats[i] == 0) zero_counter++;
	}
	cout << "Drawing histogram..." << endl;
	h->Draw("histosame");
	cout << "Found " << zero_counter << "/" << floats.size() << " zero entries" << endl;
	cout << std::setprecision(12) << "Efficiency = " << 100*(floats.size()-zero_counter)/floats.size() << "%" << endl;
	printf("Efficiency = %f % \n",100.*(floats.size()-zero_counter)/floats.size());
	TFile *f = new TFile(TString::Format("fluka.root"),"RECREATE");
	cout << "Saving File " << f->GetName() << endl;
	//TFile f(TString::Format("fluka_%s.root",file.Data()),"RECREATE");
	h->Write();
	f.Close();
}

#endif // __CINT__

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.