to link your own standalone interactive root module you will have to
add -lRint to the list of libraries specified by $ROOTLIBS in the
Makefile. On HP-UX you also have to add to the main program:
int Error;
this variable is used by libPW.a which in turn is used by Motif.
Cheers, Fons.
>
> Hello Rooters,
>
> I tried to add a simple class to ROOT to make it
> accessible from interactive interface.
>
> System is HP-UX atlas09 B.10.20 A 9000/831
> $ROOTSYS = /afs/cern.ch/na49/library/local/ROOT/hpux10/root
>
> What I've got is:
>
> Generating dictionary ...
> Note: operator new() masked 1c
> Note: operator delete() masked 1c
> Class Bubu: Streamer() not declared
> Class Bubu: ShowMembers() not declared
> CC -g -w -O +a1
> -I/afs/cern.ch/na49/library/local/ROOT/hpux10/root/include
> -c Bubudict.C
> Linking buburoot ...
> CC -g -w -O +a1 -Wl,-E main.o Bubu.o Bubudict.o
> -L/afs/cern.ch/na49/library/local/ROOT/hpux10/root/lib -lNew -lBase -lCint
> -lClib -lCont -lFunc -lGraf -lGraf3d -lHist -lHtml -lMatrix -lMeta
> -lMinuit -lNet -lPostscript -lProof -lTree -lUnix -lZip -lGpad -lGX11
> -lMotif -lWidgets -lX3d -L/usr/lib/Motif1.1 -lXm -lXt -lX11 -lm -lPW
> -ldld -o buburoot
> /usr/ccs/bin/ld: Unsatisfied symbols:
> Virtual table for class 'TRint': first non-inline virtual function in
> 'TRint' is not defined. (1930)
> Error (data)
> TRint::TRint(char*,int*,char**,void*,int) (code)
> *** Error exit code 1
>
> Any suggestions ?
> May be I missed some inmportant point...
>
> Class code and related file follow:
>
> //////////////////////////////////////////////////////
> Bubu.h:
>
> #ifndef _Bubu_
> #define _Bubu_
>
> #include "Rtypes.h"
>
> class Bubu {
>
> public:
> Bubu(Int_t id = 0);
> void Id( Int_t id );
> void Show();
>
> private:
> Int_t fBubuID;
>
> };
>
> #endif // _Bubu_
>
> ////////////////////////////////////////////
>
> Bubu.C:
>
> #include "Bubu.h"
>
> #include <iostream.h>
>
> Bubu::Bubu(Int_t id)
> {
> fBubuID = id;
> }
>
> void Bubu::Id( Int_t id)
> {
> fBubuID = id;
> }
>
> void Bubu::Show()
> {
> cout << "Hello World from Bubu " << fBubuID << endl;
> }
>
> ////////////////////////////////////////////
>
> LinkDef.h:
>
> #ifdef __CINT__
>
> #pragma link off all globals;
> #pragma link off all classes;
> #pragma link off all functions;
>
> #pragma link C++ class Bubu;
>
> #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)
> {
> TRint *theApp = new TRint("Rint", &argc, argv, 0, 0);
>
> // Init Intrinsics, build all windows, and enter event loop
> theApp->Run();
>
> delete theApp;
>
> return(0);
> }
>
> ////////////////////////////////////////////
> makefile:
>
> CXXFLAGS = -g -w -O +a1 -I$(ROOTSYS)/include
> LDFLAGS = -g -w -O +a1 -Wl,-E
> LD = $(CXX)
> ROOTLIBS = -L$(ROOTSYS)/lib -lNew -lBase -lCint -lClib -lCont -lFunc \
> -lGraf -lGraf3d -lHist -lHtml -lMatrix -lMeta -lMinuit -lNet \
> -lPostscript -lProof -lTree -lUnix -lZip
> ROOTGLIBS = -lGpad -lGX11 -lMotif -lWidgets -lX3d
>
> LIBS = $(ROOTLIBS) \
> $(ROOTGLIBS) \
> -L/usr/lib/Motif1.1 \
> -lXm -lXt -lX11 -lm -lPW -ldld
>
> HDRS = Bubu.h
>
> SRCS = main.C Bubu.C Bubudict.C
>
> OBJS = main.o Bubu.o Bubudict.o
>
> PROGRAM = buburoot
>
> all: $(PROGRAM)
>
> $(PROGRAM): $(OBJS)
> @echo "Linking $(PROGRAM) ..."
> $(LD) $(LDFLAGS) $(OBJS) $(LIBS) -o $(PROGRAM)
> @echo "done"
>
> clean:
> @rm -f $(OBJS) core *.bak buburoot Bubudict.*
>
> ###
> Bubu.o: Bubu.h
>
> Bubudict.C: Bubu.h
> @echo "Generating dictionary ..."
> @rootcint -f Bubudict.C -c Bubu.h LinkDef.h
>
>
>
>
-- Org: CERN, European Laboratory for Particle Physics. Mail: 1211 Geneve 23, Switzerland Phone: +41 22 7679248 E-Mail: Fons.Rademakers@cern.ch Fax: +41 22 7677910