Re: [ROOT] Help compiling a class

From: Victor Perevoztchikov (perev@bnl.gov)
Date: Tue Sep 19 2000 - 19:11:05 MEST


Hi Ray,

> dlopen error: /direct/u0b/rfliller/data/ROOT/./testclass.so: undefined
> symbol: ShowMembers__9TestclassR16TMemberInspectorPc

unfortunatelly for Linux and Solaris such message is usually wrong.
This means only that you do not have implemenatation for some method,
not ShowMembers. Very often it is destructor declared but not implemented.

Try:

nm testclass.so | grep Testclass | grep ' U '
and you will see all unsatisfied methods. Check them.

On HP diagnostic always correct

Victor




Ray Fliller III wrote:
> 
> Rooters,
> 
>   I'm using ROOT v 2.23/12 on Red Hat Linux V5.0/x86 with GNU make 3.77
> and gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release).
> 
>   I'm trying to compile a class that I wrote, and when the dictionary
> gets compiled, I get the same error over and over, no matter what I do.
> So I tried compiling and loading the tetris program into ROOT, it worked
> fine using the Makefile in that directory.
>   Next I made a testclass with an Int_t private memeber and some getters
> and setters to see if that would compile, no dice, same set of errors,
> but then by some miracle, it compiled and won't load into ROOT.
> 
> Header:  testclass.h
> #ifndef __Testclass__
> #define __Testclass__
> 
> #include "TObject.h"
> 
> class Testclass : public TObject{
> 
>   Int_t  name;
> 
>  public:
>   Testclass();
>   virtual ~Testclass();
>   Int_t GetTitle();
>   void SetTitle(Int_t newtitle);
>   ClassDef(Testclass,1);
> };
> 
> #endif
> 
> messages on compilation:
> rcas2023 % make
> g++ -O -Wall -fPIC -I/opt/phenix/root/include -c testclass.cxx
> Generating dictionary testclassDict...
> Note: link requested for unknown class testclass FILE:G__autoLinkDef.h
> LINE:7
> Note: operator new() masked 1c
> Note: operator delete() masked 1c
> g++ -O -Wall -fPIC -I/opt/phenix/root/include -c testclassDict.cxx
> g++ -shared -g testclass.o testclassDict.o -o testclass.so
> 
> errors in ROOT:
> root [0] gSystem->Load("testclass.so")
> dlopen error: /direct/u0b/rfliller/data/ROOT/./testclass.so: undefined
> symbol: ShowMembers__9TestclassR16TMemberInspectorPc
> Load Error: Dynamic link library
> /direct/u0b/rfliller/data/ROOT/./testclass.so can not load
> (int)(-1)
> *** Interpreter error recovered ***
> 
> Just for the record, here are the errors that I was getting (different
> class name, but identical errors).
> 
> rcas2023 % make
> g++ -O -Wall -fPIC -I/opt/phenix/root/include -c Data.cxx
> Generating dictionary testclassDict...
> Note: operator new() masked 1c
> Note: operator delete() masked 1c
> Class Data: Streamer() not declared
> Class Data: ShowMembers() not declared
> g++ -O -Wall -fPIC -I/opt/phenix/root/include -c DataDict.cxx
> DataDict.cxx: In function `int G__Data_ClassDef_8_0(struct G__value *,
> const char *, struct G__param *, int)':
> DataDict.cxx:98: parse error before `private'
> DataDict.cxx:98: warning: control reaches end of non-void function
> `G__Data_ClassDef_8_0(G__value *, const char *, G__param *, int)'
> DataDict.cxx: In function `Version_t Class_Version()':
> DataDict.cxx:98: `libp' undeclared (first use this function)
> DataDict.cxx:98: (Each undeclared identifier is reported only once
> DataDict.cxx:98: for each function it appears in.)
> DataDict.cxx:98: warning: control reaches end of non-void function
> `Class_Version()'
> DataDict.cxx: At top level:
> DataDict.cxx:98: virtual outside class declaration
> DataDict.cxx:98: non-member function `IsA()' cannot have `const' method
> qualifier
> DataDict.cxx: In function `class TClass * IsA()':
> DataDict.cxx:98: confused by earlier errors, bailing out
> make: *** [DataDict.o] Error 1
> 
> Sorry this is so long, but thanks for any help.
> 
> ==============================================================================
> Ray Fliller: rfliller@bnl.gov      Office Phone: (631)-344-6124
> C-A Accelerator Physics
> Building 911
> Brookhaven National Lab
> Upton, NY 11973                    Office: Room 211
> ==============================================================================


Ray Fliller III wrote:
> 
> Rooters,
> 
>   I'm using ROOT v 2.23/12 on Red Hat Linux V5.0/x86 with GNU make 3.77
> and gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release).
> 
>   I'm trying to compile a class that I wrote, and when the dictionary
> gets compiled, I get the same error over and over, no matter what I do.
> So I tried compiling and loading the tetris program into ROOT, it worked
> fine using the Makefile in that directory.
>   Next I made a testclass with an Int_t private memeber and some getters
> and setters to see if that would compile, no dice, same set of errors,
> but then by some miracle, it compiled and won't load into ROOT.
> 
> Header:  testclass.h
> #ifndef __Testclass__
> #define __Testclass__
> 
> #include "TObject.h"
> 
> class Testclass : public TObject{
> 
>   Int_t  name;
> 
>  public:
>   Testclass();
>   virtual ~Testclass();
>   Int_t GetTitle();
>   void SetTitle(Int_t newtitle);
>   ClassDef(Testclass,1);
> };
> 
> #endif
> 
> messages on compilation:
> rcas2023 % make
> g++ -O -Wall -fPIC -I/opt/phenix/root/include -c testclass.cxx
> Generating dictionary testclassDict...
> Note: link requested for unknown class testclass FILE:G__autoLinkDef.h
> LINE:7
> Note: operator new() masked 1c
> Note: operator delete() masked 1c
> g++ -O -Wall -fPIC -I/opt/phenix/root/include -c testclassDict.cxx
> g++ -shared -g testclass.o testclassDict.o -o testclass.so
> 
> errors in ROOT:
> root [0] gSystem->Load("testclass.so")
> dlopen error: /direct/u0b/rfliller/data/ROOT/./testclass.so: undefined
> symbol: ShowMembers__9TestclassR16TMemberInspectorPc
> Load Error: Dynamic link library
> /direct/u0b/rfliller/data/ROOT/./testclass.so can not load
> (int)(-1)
> *** Interpreter error recovered ***
> 
> Just for the record, here are the errors that I was getting (different
> class name, but identical errors).
> 
> rcas2023 % make
> g++ -O -Wall -fPIC -I/opt/phenix/root/include -c Data.cxx
> Generating dictionary testclassDict...
> Note: operator new() masked 1c
> Note: operator delete() masked 1c
> Class Data: Streamer() not declared
> Class Data: ShowMembers() not declared
> g++ -O -Wall -fPIC -I/opt/phenix/root/include -c DataDict.cxx
> DataDict.cxx: In function `int G__Data_ClassDef_8_0(struct G__value *,
> const char *, struct G__param *, int)':
> DataDict.cxx:98: parse error before `private'
> DataDict.cxx:98: warning: control reaches end of non-void function
> `G__Data_ClassDef_8_0(G__value *, const char *, G__param *, int)'
> DataDict.cxx: In function `Version_t Class_Version()':
> DataDict.cxx:98: `libp' undeclared (first use this function)
> DataDict.cxx:98: (Each undeclared identifier is reported only once
> DataDict.cxx:98: for each function it appears in.)
> DataDict.cxx:98: warning: control reaches end of non-void function
> `Class_Version()'
> DataDict.cxx: At top level:
> DataDict.cxx:98: virtual outside class declaration
> DataDict.cxx:98: non-member function `IsA()' cannot have `const' method
> qualifier
> DataDict.cxx: In function `class TClass * IsA()':
> DataDict.cxx:98: confused by earlier errors, bailing out
> make: *** [DataDict.o] Error 1
> 
> Sorry this is so long, but thanks for any help.
> 
> ==============================================================================
> Ray Fliller: rfliller@bnl.gov      Office Phone: (631)-344-6124
> C-A Accelerator Physics
> Building 911
> Brookhaven National Lab
> Upton, NY 11973                    Office: Room 211
> ==============================================================================

-- 
Victor M. Perevoztchikov   perev@bnl.gov  perev@vxcern.cern.ch       
Brookhaven National Laboratory MS 510A PO Box 5000 Upton NY 11973-5000
tel office : 631-344-7894; fax 631-344-4206; home 631-345-2690



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:33 MET