I have problems defining "operator>" or ">=", "<","<="
for my class. When generating the dictionary with rootcint the
following warning is issued (in case of ">=" ):
CC -O -KPIC -I./ -I/work/eddy/root/include -c main.C
CC -O -KPIC -I./ -I/work/eddy/root/include -c TS.C
Generating dictionary
Warning: #pragma link, function =(TS&,TS&) not found FILE:TS_LinkDef.h LINE:9
Note: operator new() masked 1c
Note: operator delete() masked 1c
CC -O -KPIC -I./ -I/work/eddy/root/include -c TSDict.C
CC -g main.o TS.o TSDict.o -L/work/eddy/root/lib -lRint -lNew -lBase -lCint -lClib -lCont -lFunc -lGraf -lGraf3d -lHist -lHtml -lMat
rix -lMeta -lMinuit -lNet -lPostscript -lProof -lTree -lUnix -lZip -lGpad -lGui -lGX11 -lX3d -L/usr/openwin/lib -L/usr/ccs/lib -lXpm
-lX11 -lm -lgen -ldl -lsocket -lsunmath -o renroot
renroot done
The error message does not show the ">". Things work fine for any other operator.
Any Clues ??
Best Regards,
Eddy Offermann
Below are my Makefile, TS_LinkDef.h, main.C, TS.C and TS.h
------------------- Makefile ----------
ObjSuf = o
SrcSuf = C
DllSuf = so
ROOTLIBS = -L$(ROOTSYS)/lib -lRint -lNew -lBase -lCint -lClib -lCont -lFunc \
-lGraf -lGraf3d -lHist -lHtml -lMatrix -lMeta -lMinuit -lNet \
-lPostscript -lProof -lTree -lUnix -lZip
ROOTGLIBS = -lGpad -lGui -lGX11 -lX3d
# Solaris
CC = CC
CCFLAGS = -O -KPIC -I./ -I$(ROOTSYS)/include
LD = CC
LDFLAGS = -g
SOFLAGS = -G
LIBS = $(ROOTLIBS) $(ROOTGLIBS) -L/usr/openwin/lib \
-L/usr/ccs/lib -lXpm -lX11 -lm -lgen -ldl -lsocket -lsunmath
MAINO = main.$(ObjSuf)
MAINS = main.$(SrcSuf)
RENROOTO = TS.$(ObjSuf) \
TSDict.$(ObjSuf)
RENROOTS = TS.$(SrcSuf) \
TSDict.$(SrcSuf)
RENROOT = renroot
OBJS = $(MAINO) $(RENROOTO) $(TSDISPLAYO)
PROGRAMS = $(RENROOT)
all: $(PROGRAMS)
$(RENROOT): $(OBJS)
$(LD) $(LDFLAGS) $(MAINO) $(RENROOTO) $(LIBS) -o $(RENROOT)
@echo "$(RENROOT) done"
clean:
@rm -f $(OBJS) core \
TSDict.$(SrcSuf) TSDict.h
.SUFFIXES: .$(SrcSuf)
###
TS.o: TS.h
TSDict.$(SrcSuf): TS.h
@echo "Generating dictionary"
@rootcint -f TSDict.$(SrcSuf) -c TS.h TS_LinkDef.h
.$(SrcSuf).$(ObjSuf):
$(CC) $(CCFLAGS) -c $<
------------------- TS_LinkDef.h ----------
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class TS;
#pragma link C++ function operator>=(TS&, TS&);
#pragma link C++ function operator+(TS&, TS&);
#endif
------------------- Main.C ----------
#include "TROOT.h"
#include "TRint.h"
extern void InitGui();
VoidFuncPtr_t initfuncs[] = { InitGui, 0 };
TROOT root("Rint","The ROOT Interactive Interface", initfuncs);
//______________________________________________________________________________
int main(int argc, char **argv)
{
char appname[] = "Rint";
TRint *theApp = new TRint(appname, &argc, argv, 0, 0);
// Init Intrinsics, build all windows, and enter event loop
theApp->Run();
delete theApp;
return(0);
}
------------------- TS.C ----------
#include <TS.h>
ClassImp(TS)
//______________________________________________________________________________
TS::TS()
{
fNrRank = 0;
}
//______________________________________________________________________________
TS::~TS()
{
}
//______________________________________________________________________________
TS& TS::operator=(const TS &ts1)
{
if (this != &ts1)
{
}
return *this;
}
//______________________________________________________________________________
TS operator>=(TS &ts1, TS &ts2)
{
TS tsnew = ts1;
return tsnew;
}
//______________________________________________________________________________
TS operator+(TS &ts1,TS &ts2)
{
TS tsnew = ts1;
return tsnew;
}
------------------- TS.h ----------
#ifndef ROOT_TS
#define ROOT_TS
//////////////////////////////////////////////////////////////////////////
// //
// TS //
// //
// Description of TS Classes //
// //
//////////////////////////////////////////////////////////////////////////
#include <TObject.h>
#include <TMath.h>
#include <TText.h>
#include <iostream.h>
class TS : public TObject {
private:
Int_t fNrRank;
public:
TS();
virtual ~TS();
TS& operator=(const TS &ts1);
friend TS operator>(TS &ts1, TS &ts2);
friend TS operator+(TS &ts1, TS &ts2);
ClassDef(TS,0) //TS structure
};
#endif