Hello,
I’m writing a C++ code to treat and to show my data.
The C++ code uses some Root libraries (TH1D, TCanvas, TFit, TGraph etc etc…)
Usually I don’t have problem on my personal computer but now I need to use the computer in the lab. (Scientific linux 6.4 Carbon, 5.22/00 Root Version)
This is the code:
[code]#include
#include
#include
#include
#include <time.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TCanvas.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TPad.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TApplication.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TGraphErrors.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TGraph.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TF1.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TAxis.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TStyle.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TH1.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TSpectrum.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TList.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TMath.h>
#include </home/program/x86_64Linux/root_v5.12.00e/include/TVirtualPad.h>
using namespace std;
TApplication app(“gui”,0,NULL);
main (){
int ndat, ncurv;
cout << “N° of point:”;
cin >> ndat;
cout << “N° of curves”;
cin >> ncurv;
cout<<"The number of curves is: "<< ncurv <<endl;
cout << "The number of points for each curve is: " << ndat << endl<<endl;
//Create histogram
TH1I h1left(“name”,“title”,10,0.0,5.0); // (“xxxx”,“xxxx”,n°bin,xmin,xmax)
//Create and close a Canvas
TCanvas c1(“name”,“title”,10,10,200,200);
c1.Close();
cout<<“End of code”<<endl;
}
[/code]
This is the command to compile:
And this is the terminal output:
root-config: Command not found.
/tmp/cchEMk0r.o: In function `main':
testCanvas.cpp:(.text+0xd7): undefined reference to `TH1I::TH1I(char const*, char const*, int, double, double)'
testCanvas.cpp:(.text+0x108): undefined reference to `TCanvas::TCanvas(char const*, char const*, int, int, int, int)'
testCanvas.cpp:(.text+0x11c): undefined reference to `TCanvas::Close(char const*)'
testCanvas.cpp:(.text+0x14e): undefined reference to `TCanvas::~TCanvas()'
testCanvas.cpp:(.text+0x165): undefined reference to `TCanvas::~TCanvas()'
testCanvas.cpp:(.text+0x17b): undefined reference to `TH1I::~TH1I()'
testCanvas.cpp:(.text+0x198): undefined reference to `TH1I::~TH1I()'
/tmp/cchEMk0r.o: In function `__static_initialization_and_destruction_0(int, int)':
testCanvas.cpp:(.text+0x20c): undefined reference to `TApplication::TApplication(char const*, int*, char**, void*, int)'
testCanvas.cpp:(.text+0x211): undefined reference to `TApplication::~TApplication()'
/tmp/cchEMk0r.o: In function `TCanvasImp::IsA() const':
testCanvas.cpp:(.text._ZNK10TCanvasImp3IsAEv[TCanvasImp::IsA() const]+0xd): undefined reference to `TCanvasImp::Class()'
/tmp/cchEMk0r.o: In function `TApplicationImp::~TApplicationImp()':
testCanvas.cpp:(.text._ZN15TApplicationImpD2Ev[_ZN15TApplicationImpD5Ev]+0x23): undefined reference to `TString::~TString()'
/tmp/cchEMk0r.o: In function `TApplicationImp::IsA() const':
testCanvas.cpp:(.text._ZNK15TApplicationImp3IsAEv[TApplicationImp::IsA() const]+0xd): undefined reference to `TApplicationImp::Class()'
/tmp/cchEMk0r.o:(.rodata._ZTV15TApplicationImp[vtable for TApplicationImp]+0x78): undefined reference to `TApplicationImp::ShowMembers(TMemberInspector&, char*)'
/tmp/cchEMk0r.o:(.rodata._ZTV15TApplicationImp[vtable for TApplicationImp]+0x80): undefined reference to `TApplicationImp::Streamer(TBuffer&)'
/tmp/cchEMk0r.o:(.rodata._ZTV10TCanvasImp[vtable for TCanvasImp]+0xc8): undefined reference to `TCanvasImp::ShowMembers(TMemberInspector&, char*)'
/tmp/cchEMk0r.o:(.rodata._ZTV10TCanvasImp[vtable for TCanvasImp]+0xd0): undefined reference to `TCanvasImp::Streamer(TBuffer&)'
collect2: ld returned 1 exit status
Thank you all in advance
Regards
Cino