Hi Axel,
You can do two things.
First you can compile the rootcint dictionary without the KCC option --strict.
(--strict inforces a pickier C++ standard compliance).
Second you can also hand declare the operator>> in your header within the
namespace.
namespace mynamespace{
TBuffer &operator>>(TBuffer &buf, MyClass *&obj);
}
Currently the issue is that this operator is only declared as a friend
of MyClass within the ClassDef definition. For ROOT 3.02.xx we hope to
upgrade the ClassDef mechanism to lift some of this annoyances.
Cheers,
Philippe
-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Axel Naumann
Sent: Tuesday, July 10, 2001 6:38 PM
To: Roottalk@Pcroot. Cern. Ch
Subject: [ROOT] operator >> in namespaces
Hi,
I run into the following problem when trying to compile the dictionary for
this "namespaced" class:
---
namespace mynamespace{
class MyClass{
public:
MyClass(){};
~MyClass(){};
int i;
ClassDef(MyClass,1)
};
}
---
Building the dict with this linkdef.h
---
#ifndef _INCLUDE_LINKDEF
#define _INCLUDE_LINKDEF
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ nestedclass;
#pragma link C++ nestedtypedef;
#pragma link C++ namespace mynamespace;
#pragma link C++ class mynamespace::MyClass+;
#endif
#endif
---
and compiling it with KCC 4.0d on IRIX 6.5 I get the following error:
"mydictfile.cpp", line 17: error #135: namespace "mynamespace"
has no member "operator>>"
TBuffer &mynamespace::operator>>(TBuffer &buf, mynamespace::MyClass *&obj)
^
Too bad KCC is so picky, Win MSVC++ and GCC don't care about that. Any idea
what I could do (to get it compiled under KCC, that is)? Btw, does this
operator _have_ to be in the namespace?
Cheers, Axel.
This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:51 MET