Re: Can not add my class to root

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Jun 08 1998 - 16:05:21 MEST


Hi Xie,

   the "Note:" messages are normal and can be ignored. However to 
generate a dictionary for the class test you've to use a LinkDef.h
file (this file can be omitted only when the class name is the
same as the .h file minus .h so, class test must be in file test.h).
For more on LinkDef.h see: http://root.cern.ch/root/RootCintMan.html.

Cheers, Fons.


Wei Xie wrote:
> 
> Dear Rooters'
> 
> The following code is used to generate a shared library. During the
> compilation, it gives some warning messages like:
> 
> **  Note: operator new() masked 1c
> **  Note: operator delete() masked 1c
> **  Warning: Link requested for undefined class ooImp  FILE: LINE:0
> 
> and finally generate the library "oo.sl". But after I load it into root
> using gSystem.Load("oo.sl"), and type :
> 
> --     .class test
> 
> it shows:
> 
> ** Error: class,struct,union or type test not defined  FILE: LINE:0
> 
> Could you tell me what's the problem ?
> 
> Sincerely yours
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> name:  ooImp.h
> ^^^^^^^^^^^^^^^
> #ifndef main_test
> #define main_test
> 
> #include <TGFrame.h>
> 
> class test: public TGFrame
> {
>    private:
>       TGFrame *frame;
>    public:
>       test(const TGWindow *p,UInt_t w, UInt_t h);
>       ~test();
> 
>    ClassDef(test,1)
> 
> };
> 
> #endif
> 
> ^^^^^^^^^^^^^^^^^^
> name: ooImp.c
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> #include "ooImp.h"
> 
> ClassImp(test)
> 
> test::test(const TGWindow *p,UInt_t w, UInt_t h):TGFrame(p,w,h)
> {
>   frame = new TGFrame(gClient->GetRoot(),w,h);
>   frame->MapWindow();
> }
> 
> test::~test()
> {
>    delete frame;
> }
> 
> ^^^^^^^^^^^^^^^^^^
> Makefile
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> # HP-UX with CC
> CXX           = CC
> CXXFLAGS      = -w -g +a1 +Z -I$(ROOTSYS)/include
> LD            = CC
> LDFLAGS       = -w -g +a1 -b
> OBJS          = ooImp.o ooDict.o
> SRCS =  ooImp.c ooDict.C
> PROGRAMS      = oo.sl
> 
> all:            $(PROGRAMS)
> 
> $(PROGRAMS):   $(OBJS)
>                 $(LD) $(LDFLAGS) $(OBJS) $(ROOTLIBS) -o $(PROGRAMS)
>                 chmod 555 $(PROGRAMS)
>                 @echo "$(PROGRAMS) is done"
> 
> clean:
>                 rm -f $(OBJS) ooDict.*
> 
> #.SUFFIXES: .c
> 
> ###
> 
> .c.o:
>         $(CXX) $(CXXFLAGS) -c $<
> ###############
> 
> ooImp.o:  ooImp.h
> ooDict.C:  ooImp.h
>         @echo "generating dictionary ..."
>         @rootcint ooDict.C -c ooImp.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



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