Barth
August 6, 2015, 10:01am
1
Dear all,
Let’s say that I develop a program that will create a TH1 and store it to file amongst many other things.
Is is necessary to create a TApplication object ? Is it recommended ? why ?
Thank you,
Barth
Hi,
afaik it is not necessary. At least I haven’t experienced any problem when
using parts of root in stand-alone applications.
Cheers,
Jochen
Search for “TApplication ” in the “ROOT Primer (5.34) ” and the “ROOT User’s Guide (5.34) ”.
See also some examples:
Hola rooterinos
I have already fixed this issue, after following advice in an old post by Le Pew, however it would be nice to know how to link properly, without this workaround.
My system is 14.04 ubuntu, I use the 5.34 root-system .deb available in the repositories. g++ 4.8.2
My code
g++ -o ted ted.cpp root-config --cflags --glibs -lTree && ./ted
Warning in TClass::TClass : no dictionary for class TTree is available
Warning in TClass::TClass : no dictionary for class TBranch is available
W…
Hi,
following code:
[code]#include
#include
#include
#include <RooRealVar.h>
#include <TFile.h>
#include <TH1D.h>
using namespace std;
// evil hack - what the fuck?
RooRealVar x;
const string filename = “foo.root”;
const string histoname = “foo/bar”;
int main(int argc, char *argv[]) {
TFile *file = new TFile(filename.c_str(), “READ”);
TH1D *h = (TH1D*) file->Get(histoname.c_str());
cout << "h->GetEntries(): " << h->GetEntries() << endl;
file->Close();
delete file;
return EXIT…
Dear Rooters,
(using ROOT 5.34.05 on Ubuntu 12.04.02 with gcc 4.6.3)
gcc 4.6.3 uses the ld flag --as-needed by default. This leads to the following trap:
Compiling and linking the att simple program with:
g++ minimal.cpp `root-config --cflags --ldflags --libs`
works without errors.
Running it with ./a.out and hsimple.root from the tutorials results in:
Warning in <TClass::TClass>: no dictionary for class TH1F is available
....
*** Break *** segmentation violation
Compiling and linking wit…
I’m very new to ROOT, and I’m just starting on research work. I do have many years of experience with C++ though, among many other languages. So that’s my background.
I’m trying to extract some simple data from a D3PD, to make some graphs. I can get things to work in a root shell, but as soon as I move to compiling things everything breaks down. Here’s my code:
#include <root/TFile.h>
#include <root/TROOT.h>
#include <root/TKey.h>
#include <root/TTree.h>
#include <root/TTreePlayer.h>
#include <…