RE: [ROOT] Pb with TFile

From: Sebastien Greder (greder@in2p3.fr)
Date: Wed Apr 10 2002 - 19:42:33 MEST


Hi Philippe,

thanks to reply so quickly (it's the first time I use this mailing list !)

The version I use is : 3.02.07 on Linux with g++.

To be clear, I give you a small code which give rise to the same problem:

compil.C :

{
gROOT->Reset();

// Get your Working directory

TString pwd = gSystem->pwd();
gSystem->Load("/cern/2001/root.3.02.07/lib/libPhysics.so");
gSystem->Load("/cern/2001/root.3.02.07/lib/libCore.so");

// Process some utilities methods

gROOT->ProcessLine(".L /home/sgreder/root/utilities/FindFile.C+");
}

and FindFile.C :

#include <iostream> 
#include "TSystem.h"
#include "TString.h"
#include "TROOT.h"
#include "TFile.h"

TFile* FindFile(TString filename, TString pathname)
 {
 TString workingdir = gSystem->WorkingDirectory() ;
 gSystem->ChangeDirectory(pathname);
 cout << "I am in the directory : " << gSystem->WorkingDirectory() <<
endl;
 cout << "Searching file " << filename.Data() << " .... " << endl;
 void *dirp = gSystem->OpenDirectory(".");
 
 TFile *myfile ;
    const char *afile;    
    while(afile = gSystem->GetDirEntry(dirp)) {
      cout << "afile : " << afile << endl;
      if (strcmp(afile,filename.Data()) == 0){
       myfile = new TFile(afile,"RECREATE","",1);
      
cout << "File : " << filename.Data() << " has been found in "<<
pathname.Data() << endl;
      }
     }
     if(myfile == 0) cout << "No file " << filename.Data() << " has been
found in " << pathname.Data() << endl; 
 gSystem->FreeDirectory(dirp);
 gSystem->ChangeDirectory(workingdir);
 return myfile ;
 }    

and then I run : .x compil.C in ROOT

and I get the following error message :

Info in <ACLiC>: creating shared library
/home/sgreder/root/utilities/FindFile_C.so
/home/sgreder/root/utilities/FindFile.C: In function `class TFile *
FindFile(class TString, class TString)':
In file included from /home/sgreder/root/utilities/filetjO4PP.h:29,
                 from /home/sgreder/root/utilities/filetjO4PP.C:5:
/home/sgreder/root/utilities/FindFile.C:17: warning: suggest parentheses
around assignment used as truth value
dlopen error: /home/sgreder/root/utilities/FindFile_C.so: undefined
symbol: __5TFilePCcPCcT1i
Load Error: Failed to load Dynamic link library
/home/sgreder/root/utilities/FindFile_C.so
/home/sgreder/root/utilities/FindFile.C: In function `class TFile *
FindFile(class TString, class TString)':
In file included from /home/sgreder/root/utilities/filetjO4PP.h:29,
                 from /home/sgreder/root/utilities/filetjO4PP.C:5:
/home/sgreder/root/utilities/FindFile.C:17: warning: suggest parentheses
around assignment used as truth value
/usr/lib/crt1.o(.text+0x18): undefined reference to `main'
/home/sgreder/root/utilities/filetjO4PP.o: In function
`G__Sizep2memfuncfiletjO4PP::G__Sizep2memfuncfiletjO4PP(void)':
/home/sgreder/root/utilities/filetjO4PP.C(.text+0x212): undefined
reference to `TFile::TFile(char const *, char const *, char const *, int)'
collect2: ld returned 1 exit status
!!!Dictionary position not recorvered because G__unloadfile() in macro!!!
*** Interpreter error recovered ***

 *** Break *** segmentation violation

Cheers,
seb.



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:50:48 MET