Hi all,
Here is a project that I’m trying to compile a Root file that hasn’t worked. What I’m trying to do is to either create an executable outside of the ROOT environment, or to run it in Root, without it interpreting every line. Below is the program and the error message I get from the terminal.
-This was ran on Red Hat Fedora Core 1 with gcc 3.3.2
#include “TROOT.h”
#include “TSystem.h”
#include “TChain.h”
#include “TH2D.h”
#include “TDirectory.h”
#include “TList.h”
#include <stdlib.h>
#include <stdio.h>
#include “Rtypes.h”
#include “TChainElement.h”
#include “TTree.h”
#include “TCache.h”
#include “TFile.h”
int main(void)
{
TFile f("./EX_SF_1994_9.0.root");
TTree Coincidences = (TTree)gDirectory->Get(“Coincidences”);
//Declaration of leaves types - TTree Coincidences
//
//------
//
Int_t rsectorID1, rsectorID2, moduleID1, moduleID2;
Int_t submoduleID1, submoduleID2, crystalID1, crystalID2;
//
//Set branch addresses - Coincicences
Coincidences->SetBranchAddress(“rsectorID1”,&rsectorID1);
Coincidences->SetBranchAddress(“rsectorID2”,&rsectorID2);
Coincidences->SetBranchAddress(“moduleID1”,&moduleID1);
Coincidences->SetBranchAddress(“moduleID2”,&moduleID2);
Coincidences->SetBranchAddress(“submoduleID1”,&submoduleID1);
Coincidences->SetBranchAddress(“submoduleID2”,&submoduleID2);
Coincidences->SetBranchAddress(“crystalID1”,&crystalID1);
Coincidences->SetBranchAddress(“crystalID2”,&crystalID2);
Int_t nentries = Coincidences->GetEntries();
Int_t nbytes = 0;
Int_t NRING = 18;
Int_t NDET = 672;
Int_t j = 0, k = 0;
TH2D *sinogram_u2[NRING][NRING];
char hname[20];
for (j=0; j < NRING; j++)
{
for (k=0; k < NRING; k++)
{
sprintf(hname,“S_I%d_%d”,j,k);
sinogram_u2[j][k] = new TH2D(hname,“UShort Integer Sinogram”,
NDET/2,0,NDET/2-1,
NDET/2,-NDET/4,NDET/4-1);
}
}
}
Error statement
/tmp/ccuUJxah.o(.text+0x36): In function main': : undefined reference toTFile::TFile[in-charge](char const*, char const*, char const*, int)’
/tmp/ccuUJxah.o(.text+0x41): In function main': : undefined reference togDirectory’
/tmp/ccuUJxah.o(.text+0x53): In function main': : undefined reference togDirectory’
/tmp/ccuUJxah.o(.text+0x3e1): In function main': : undefined reference toTH2D::TH2D[in-charge](char const*, char const*, int, double, double, int, double, double)’
/tmp/ccuUJxah.o(.text+0x424): In function main': : undefined reference toTObject::operator delete(void*)’
/tmp/ccuUJxah.o(.text+0x46a): In function main': : undefined reference toTFile::~TFile in-charge’
/tmp/ccuUJxah.o(.text+0x490): In function main': : undefined reference toTFile::~TFile in-charge’
/tmp/ccuUJxah.o(.gnu.linkonce.t._ZN7TObjectnwEj+0xd): In function TObject::operator new(unsigned)': : undefined reference toTStorage::ObjectAlloc(unsigned)'
collect2: ld returned 1 exit status
make: *** [tester7] Error 1
Any suggestions would be extremely helpful.
Thanks,
ross
. Still pretty much a novice with c++ and using the compiler correctly
.