ROOT 6 in macOS 10.13

I am having trouble in using root 6 with macOS 10.13.
I tried to use the example provided in the root user guide:
And I get the following error:

rootcling eventdict.cxx -c TEvent.h TTrack.h
In file included from input_line_10:6:
./TEvent.h:1:2: error: unterminated conditional directive
#ifndef __TEvent__
In file included from input_line_10:7:
./TTrack.h:15:24: error: unknown type name 'Event'
     TTrack(Int_t id, Event *ev, Float_t px,Float_t py,Float_t pz);
Error: rootcling: compilation failure (./eventdictddf9b8d999_dictUmbrella.h)

I also used different method of makefile using a simple configuration, which was running fine in linux using root 5.34.:
MakeFile contains the follwing:



MyDict.cxx: $(HEADERS) Linkdef.h
       rootcling  $@ -c  $^  MyDict.cxx $(SOURCES)
       $(CXX) -shared -o$@ $(CXXFLAGS) -std=c++11 -I$(ROOTSYS)/include/ $^

       rm MyDict* libMyEvent*

And my MyEvent.h contains:

#ifndef __MYEVENT__
#define __MYEVENT__
#include <iostream>
#include "TObject.h"

class MyEvent{
 MyEvent(){ px = 0; py = 0; pt = 0;};
 virtual ~MyEvent(){};

 void setPx(float x_){ px = x_;};
 void setPy(float y_){ py = y_;};
 void setPt(float t_){ pt = t_;};

 float getPx(){return px;};
 float getPy(){return py;};
 float getPt(){return pt;};

 float px;
 float py;
 float pt;

And LinkDef.h contains:

#include "MyEvent.h"
#include <vector>

#ifdef __CLING__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class MyEvent+;
#pragma link C++ class std::vector<MyEvent>;

#endif /* __CLING__ */

Please let me know if there is any better way to do this.

AND Please give me proper and working instructions(if any) for using ROOT with macOS 10.13.

Thanks in advance,

Shouldn’t it be TTrack(Int_t id, MyEvent *ev, Float_t px,Float_t py,Float_t pz);?
(i.e. MyEvent *ev instead of Event *ev)

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