Problem adding an object created by MakeClass


I have a very simple problem with 6.14, but I reinstalled everything from scratch with the latest root version and I still have the problem.

I created using MakeClass the files DataMC.C and DataMC.h, and I am trying to run this

gROOT->ProcessLine(".L DataMC.C+");
TChain *ch1 = new TChain(“tree”,"");
TTree tree1 = (TTree) ch1;

DataMC t(tree1);

I when I run it in root (root -l myPlot.C) I get:

root [0]
Processing MyPlot.C…
/home/eduard/work/./MyPlot.C:15:8: error: expected ‘;’ after expression
DataMC t(tree1);
/home/eduard/work/./MyPlot.C:15:9: error: use of undeclared identifier ‘t’
DataMC t(tree1);

Some how my root installation does not identify the new class DataMC.

but if I do it by hand it works!. I missed/messed up something.

Thanks for any help,

ROOT Version: 6.16
Platform: Ubuntu 18.04
Compiler: gcc version 7.3.0

Do you #include "DataMC.h" in your code?

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