You have to call the TFile constructor properly
Either use
TFile* rootfile = new TFile(fname,"recreate");
or type
TFile rootfile(fname,"recreate");
Roger Mason wrote:
> Hello,
>
> I'm trying to compile a standalone program but get an error. Here is
> a minimal example:
>
> // $Id: energy.C,v 1.3 2008/04/17 19:53:31 rmason Exp $
>
> #ifndef __CINT__
> #include <TMath.h>
> #include <fstream>
> #include <TStopwatch.h>
> #include <TRandom3.h>
> #include <TFile.h>
> #include <iostream>
> #include <TTree.h>
> #include <TTimeStamp.h>
> #include <stdlib.h>
> #include <stdio.h>
>
> using namespace std;
>
> int failure(Long64_t, int);
>
> //______________________________________________________________________________
> int main()
> {
> return failure(24,1);
> }
> #endif
>
> // The main entry point
> //int energy(Long64_t mnatoms = 24, int number = 1)
> int failure(Long64_t mnatoms, int number)
> {
> char fname[20];
> sprintf(fname,"Ca%lliMn%lli.root", 24,24);
> cout << "filename = " << fname << endl;
> TFile rootfile = TFile(fname,"recreate");
> return 0;
> }
>
> The error is:
>
> failure.cxx: In function 'int failure(Long64_t, int)':
> /usr/include/root/TFile.h:126: error: 'TFile::TFile(const TFile&)' is
> private
> failure.cxx:33: error: within this context
> /usr/include/root/TFile.h:126: error: 'TFile::TFile(const TFile&)' is
> private
> failure.cxx:33: error: within this context
> make: *** [failure.o] Error 1
>
> I'm using root 5.18/00 and gcc (GCC) 4.1.1 (Gentoo 4.1.1-r3 p1.10).
>
> Thanks for any help,
>
> Roger
>
Received on Thu Apr 24 2008 - 14:46:53 CEST
This archive was generated by hypermail 2.2.0 : Thu Apr 24 2008 - 17:50:01 CEST