Hi,
I'm trying to add a template class in ROOT using cint but with no succes.
I had a look at the roottalk but I couldn't find any satisfactory answer.
Where can I find a complete correct example for that ?
For information, here is my code:
test.h file :
---------------------------------------
#ifndef TEST_H
#define TEST_H
#include <iostream>
#include "root.h"
using namespace std;
template<class Type> class Test : public TObject
{
private:
Type _x;
public:
void Print(){cout << _x << endl;}
Test(){};
Test(Type x){_x=x;}
~Test(){};
ClassDef(Test,0)
};
#endif
-----------------------------------------
test.cc file :
-----------------------------------------
#include "root.h"
#include "test.h"
ClassImp(Test)
-----------------------------------------
LinkDef.h file :
-----------------------------------------
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class Test<int>;
#endif
------------------------------------------
Makefile :
------------------------------------------
ROOTCFLAGS = $(shell root-config --cflags)
ROOTLIBS = $(shell root-config --libs)
ROOTGLIBS = $(shell root-config --glibs)
ROOTCINT = $(ROOTSYS)/bin/rootcint
# Linux with egcs
CXX = g++
CXXFLAGS = -O -Wall -fPIC
LD = g++
LDFLAGS = -g
SOFLAGS = -shared
AR = ar
CXXFLAGS += $(ROOTCFLAGS)
LIBS = $(ROOTLIBS)
GLIBS = $(ROOTGLIBS)
OBJECTS= test.o cintDict.o
IOOBJECTS=
MKLIBS= libtest.a
all: $(MKLIBS)
clean:
rm -f $(MKLIBS) *.o cintDict.*
cintDict.cc: test.h LinkDef.h
$(ROOTCINT) -T -f $@ -c $^
.cc.o:
$(CXX) -c $< $(CXXFLAGS)
libtest.a: $(OBJECTS)
$(AR) -r $@ $^
install:
rm -f *.o cintDict.*
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:36 MET