RE: [ROOT] problems compiling code that works in ROOT

From: Philippe Canal (pcanal@fnal.gov)
Date: Wed Jul 16 2003 - 18:44:41 MEST


Hi Chris,

You need to provide a dictionary for the class Chamber by using rootcint.

Cheers,
Philippe

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Chris Hayward
Sent: Wednesday, July 16, 2003 10:48 AM
To: ROOT Talk Mailing List
Subject: [ROOT] problems compiling code that works in ROOT


Hello,
I am running ROOT 3.05/05 with gcc 2.96 on lxplus. I have written a small
program that reads data into an object of type "Chamber", which is a class
I have defined, and adds the object as a branch to a tree. The code works
fine when I run it in ROOT, but when I try to compile with g++ it gives me
the error message: "Error in <TTree::Bronch>: Cannot find class:Chamber."
Why is this the case, and what can I do to correct it?

The relevant code is attached below.

Thanks,
Chris Hayward


#include <iostream.h>
#include <fstream.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

#include </afs/cern.ch/user/x/xtomo/chris/Chamber.h>
#include </afs/cern.ch/user/x/xtomo/chris/Chamber.cxx>

void ReadChamber(char path[100], TTree *tree);

void main() {

        TFile f("test_RC.root","RECREATE");
        char path[100] = " ";
        TTree *tree = new TTree();

strcpy(path,"/afs/cern.ch/user/x/xtomo/www/Results/Munich/BOS3A_MPI_048
_2002_12/index.html");
        ReadChamber(path,tree);
        f.Write();
        cout << "success!" << endl;

} //end main


void ReadChamber(char path[100], TTree *tree) {

  Chamber *chamber = new Chamber();

//lots of data entry that I've cut out

//buffer is a string containing branch name
  tree->Branch(buffer,"Chamber",&chamber,32000,99);

  tree->Fill();                //fill the tree from the chamber object
  tree->Print();

} //end ReadChamber


#################################################################
#################################################################
#################################################################
#####
#####
#####
#################################################################
#################################################################
#################################################################



This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:13 MET