RE: TFile problem

From: Fine, Valeri <fine_at_bnl.gov>
Date: Thu, 24 Apr 2008 22:43:34 -0400


Hello Roger,  

Is  

> TFile rootfile = TFile(fname,"recreate");

really what you wanted ?  

Did you want  

  TFile *rootfile = new TFile(fname,"recreate");

instead.  

Thank you, Valeri


From: owner-roottalk_at_root.cern.ch on behalf of Roger Mason Sent: Thu 4/24/2008 8:27 AM
To: roottalk_at_lxbuild091.cern.ch
Subject: [ROOT] TFile problem

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 Fri Apr 25 2008 - 04:46:15 CEST

This archive was generated by hypermail 2.2.0 : Fri Apr 25 2008 - 11:50:01 CEST