Dear Rooters,
I would like to add classes to cint, to make them available in the
interpreter. My classes are, however, in a namespace.
I did not find on the root www site how to do this, and I did
not manage. Does anyone know how to do this?
I am working on HP_UX 10.20 with aCC.
Root Version 2.22/10 (28 July 1999),
Cint version 5.14.10 (Jul 20 1999)
When my class did not work, I went back to the MyClass example in
http://root.cern.ch/root/CintGenerator.html.
First without any namespace.
rootcint -f maindict.cxx -c -p MyClass.h
Works fine.
Then I put MyClass in namespace 'mine'. Then rootcint gives the following 'Note':
rootcint -f maindict.cxx -c -p MyClass.h
Note: link requested for unknown class MyClass FILE:./G__autoLinkDef.h LINE:7
and cint does not know about the class, nor the namespace:
root [1] .class MyClass
Error: class,struct,union or type MyClass not defined FILE: LINE:0
*** Interpreter error recovered ***
root [3] .class mine::MyClass
Error: class,struct,union or type mine not defined FILE: LINE:0
Error: class,struct,union or type mine not defined FILE: LINE:0
Error: class,struct,union or type mine not defined FILE: LINE:0
Error: class,struct,union or type mine::MyClass not defined FILE: LINE:0
*** Interpreter error recovered ***
root [4] .class mine
Error: class,struct,union or type mine not defined FILE: LINE:0
*** Interpreter error recovered ***
So I added my own mainLinkDef.h file containing:
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class mine::MyClass;
#endif
and try again:
rootcint -f maindict.cxx -c -p MyClass.h mainLinkDef.h
Great! 'Note' is gone!
However, at startup of myroot, I get two error messages:
Error: class,struct,union or type mine not defined FILE: LINE:0
Error: class,struct,union or type mine not defined FILE: LINE:0
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 2.22/10 28 July 1999 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
*******************************************
CINT/ROOT C/C++ Interpreter version 5.14.10, Jul 20 1999
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
*** Interpreter error recovered ***
root [0] .class MyClass
===========================================================================
class MyClass
size=0x0
(tagnum=376,voffset=-1,isabstract=0,parent=-1,gcomp=0,=~cd=0)
List of base class--------------------------------------------------------
List of member variable---------------------------------------------------
Defined in MyClass
List of member function---------------------------------------------------
filename line:size busy function type and name (in MyClass)
root [1] .class mine::MyClass
Error: class,struct,union or type mine not defined FILE: LINE:0
===========================================================================
class MyClass
size=0x0
(tagnum=376,voffset=-1,isabstract=0,parent=-1,gcomp=0,=~cd=0)
List of base class--------------------------------------------------------
List of member variable---------------------------------------------------
Defined in MyClass
List of member function---------------------------------------------------
filename line:size busy function type and name (in MyClass)
*** Interpreter error recovered ***
root [2]
The class name is there (outside the namespace!), but the class is empty...
The namespace is not recognised.
I then tried in mainLinkDef.h several combination of the following pragma's:
#pragma link C++ namespace mine;
#pragma link C++ nestedclass;
#pragma link C++ nestedtypedef;
#pragma link C++ defined_in namespace mine;
#pragma link C++ defined_in mine;
All with different errors/problems. I did not find the magic combination.
Could somebody please help me with this?
Regards,
Martin.
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:19 MET