Re: root functions in c++ code

From: Mario Kadastik <mario.kadastik_at_cern.ch>
Date: Mon, 23 Aug 2010 13:54:20 +0200


> Maybe it is a dumb question, but is there a way to call root functions from a normal c++ code somehow without the use of the interpreter?
> Regards,

Yes, just link your code against ROOT. Here's a compile script I use to compile against both Pythia and ROOT my private C++ code where I use functions from both.

#!/bin/sh
g++ -o $1 $1.cc `root-config --cflags --libs --glibs` -L pythia/lib/archive -lpythia8 -llhapdfdummy -I pythia/include

the relevant part for you is the root-config part I guess. In the code you then just need to include the necessary header files.. i.e.

#include "TFile.h"
#include "TH1.h"
#include "TH2.h"

...

Enjoy,

Mario Kadastik, PhD
Researcher

---
  "Physics is like sex, sure it may have practical reasons, but that's not why we do it" 
     -- Richard P. Feynman
Received on Mon Aug 23 2010 - 13:54:25 CEST

This archive was generated by hypermail 2.2.0 : Mon Aug 23 2010 - 17:50:02 CEST