Adding own rootclass


At the momentI am trying to add my own classes to ROOT.
With the tutorials, the user guide and some internet search i was able to add my class TCluster to ROOT.
Everything is running fine and I am able to write objects of type TCluster to root files.

In the next step I would like to write a Class TPlane.
This class should include 2 vectors with TCluster elements.

Now, I am trying to complile this and I do not really find some informations what i have to write in the makefile.
My header of TPlane looks like that:

#ifndef TPlane_hh
#define TPlane_hh
#include "TObject.h"
#include "TCluster.hh"
class TPlane:public TObject {
	virtual ~TPlane();	
	vector<TCluster> xClusters, yClusters;

I also have a source file which contains the ClassImp(TCluster);

my first querstion is: what do i have to write in the LinkDef file?
At the moment it looks like that:

#ifdef __CINT__
#include <vector>
#pragma link C++ class vector<TCluster>+;
#pragma link C++ class TPlane+;

What do I have to add in the makefile?
Is that correct:[code] TPlaneDict.o TPlane.o TClusterDict.o TCluster.o
# Creating Shared ROOT Lib
# Please do: export LD_LIBRARY_PATH+=$LD_LIBRARY_PATH:~/lib
g++ -g -fPIC -Wall -m64 -shared $(LDFLAGS) -o $@ $^
cp -rfv ~/lib/
# Please do: export LD_LIBRARY_PATH+=$LD_LIBRARY_PATH:~/lib

TPlaneDict.cpp: $(INCLUDEDIR)/TPlane.hh $(INCLUDEDIR)/TPlaneLinkDef.h
# compiling $@
#echo $(ROOTSYS)/bin/rootcint -v -f TPlaneDict.cpp -c $(INCLUDEDIR)/TPlane.hh $(INCLUDEDIR)/TPlaneLinkDef.h
$(ROOTSYS)/bin/rootcint -v -f TPlaneDict.cpp -c $(INCLUDEDIR)/TPlane.hh $(INCLUDEDIR)/TCluster.hh $(INCLUDEDIR)/TPlaneLinkDef.h

TPlaneDict.o: TPlaneDict.cpp
g++ $(CFLAGS) -fPIC -c -m64 -o $@ $<


I tried various of possibilities, but did not found a way to make it work.
This is the current complaining while making:

rootcint -v  -f TPlaneDict.cpp  -c include/TPlane.hh include/TCluster.hh include/TPlaneLinkDef.h 
Error: class,struct,union or type __signed not defined  /usr/include/i386/_types.h:37:
Warning: Unknown type _POSIX_C_SOURCE in function argument /usr/include/dirent.h:103:
Error: Missing one of '{' expected at or after line 104.
Error: Unexpected end of file (G__fignorestream():3) /usr/include/dirent.h:142:
Note: macro handled as typedef dirent direct; /usr/include/sys/dir.h:78:
Note: File "include/TCluster.hh" already loaded
Warning: Error occurred during reading source files
Warning: Error occurred during dictionary source generation
!!!Removing TPlaneDict.cpp TPlaneDict.h !!!
Error: /Users/bachmair/sdvlp/root/bin/rootcint: error loading headers...
make: *** [TPlaneDict.cpp] Error 1

it would be great if someone can help me, i am stucked…

[code]#ifdef CINT

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class TCluster+;
#pragma link C++ class vector+;
#pragma link C++ class TPlane+;



Thanks for the answer, it helps a bit. But i am still stucked.
Am I right that i still have to build the TCluster class asi did before?
So I first create the, which needs TClusterDict.o TCluster.o

and afterwards i create the

Now I have the problem that i complaines about duplicate symbol:

g++ -g -fPIC -Wall -m64 -shared -g -L/Users/bachmair/sdvlp/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lpthread -Wl,-rpath,/Users/bachmair/sdvlp/root/lib -lm -ldl -o TPlaneDict.o TPlane.o TCluster.o TClusterDict.o ld: duplicate symbol ROOT::GenerateInitInstance(TCluster const*) in TClusterDict.o and TPlaneDict.o for architecture x86_64
What do i do wrong?


The “TPlaneLinkDef.h” contains entries for “TCluster”, so the “TPlaneDict” will also contain them, hence you should not build separate “TClusterDict”.