Adding my own class to ROOT

From: Glen R. Salo (salo@coax.net)
Date: Fri Dec 04 1998 - 06:49:13 MET


I am having problems adding my own class to ROOT.  My sample code compiles,
but fails on the link.  The error message I get is:

/tmp/cca018401.o: In function `IO::ImplFileLine(void)':
/home/gsalo/root/io.C:20: undefined reference to
`IO::ShowMembers(TMemberInspector &, char *)'
/tmp/cca018401.o: In function `IO::IO(void)':
/home/gsalo/root/io.C:22: undefined reference to
`IO::Streamer(TBuffer &)'
collect2: ld returned 1 exit status
 
The test code along with the compiler commands are given below.  I am running
version 2.20 under Redhat 5.2.  Any idea what I'm doing wrong?

Thanks for your help.

Glen

#include "TFile.h"
#include "TObject.h"
#include <iostream>

class myclass : public TObject {

private:
  Int_t a;

public:
  myclass();
  ~myclass();
  void seta(Int_t aa);
  Int_t geta();

  ClassDef(myclass,1)

};

ClassImp(myclass)

myclass::myclass() { }
myclass::~myclass() { }
void myclass::seta(Int_t aa) { a = aa; }
Int_t myclass::geta() { return a; }

int main () {

  myclass var;
  
  var.seta(30);
  cout << var.geta() << endl;

  TFile file = TFile("test.dat","RECREATE");
  var.AppendDirectory();

  return 0;

}

 g++ -o io -g -Wall -fno-rtti -fno-exceptions -fPIC io.C
-I/usr/local/root/include -L/usr/local/root/lib -L/usr/X11R6/lib -lNew -lBase
-lCint -lClib -lCont -lFunc -lGraf -lGraf3d -lHist -lHtml -lMatrix -lMeta
-lMinuit -lNet -lPostscript -lProof -lTree -lUnix -lZip -lGpad -lGui -lGX11
-lX3d -lXpm -lX11 -lm -ldl -rdynamic

/tmp/cca018471.o: In function `myclass::ImplFileLine(void)':
/home/gsalo/root/io.C:20: undefined reference to
`myclass::ShowMembers(TMemberInspector &, char *)'
/tmp/cca018471.o: In function `myclass::myclass(void)':
/home/gsalo/root/io.C:22: undefined reference to `myclass::Streamer(TBuffer &)'
collect2: ld returned 1 exit status



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:40 MET