ClassDef "cannot initialize return object of type 'TClass *' with an lvalue of type 'const char [13]'"

I have a class with the ClassDef macro in it. Very roughly this class is like;

class VNetworkBase {
  // Constructors
  explicit VNetworkBase(const std::string &inputFile);
  VNetworkBase(const VNetworkBase &copy_from);
  virtual ~VNetworkBase();
  typedef std::map<std::string, int> NetworkIO;
  virtual NetworkIO compute(NetworkIO inputs) = 0;

  // Other stuff....

  // More other stuff...
  ClassDef("VNetworkBase", 1);

And when I try to compile I get an error;

In file included from input_line_7:1:
In file included from /afs/$
In file included from /afs/$
kBase.h:274:12: error: cannot initialize return object of type 'TClass *' with an lvalue of type 'const char [13]'
  ClassDef("VNetworkBase", 1);
/cvmfs/ note: expanded from macro 'C$
   _ClassDefOutline_(name,id,virtual,)               \
/cvmfs/ note: expanded from macro '_$
   _ClassDefBase_(name,id, virtual_keyword, overrd)       \
/cvmfs/ note: expanded from macro '_C
   virtual_keyword TClass *IsA() const overrd { return name::Class();

(+ more error in consequence of that error)

I’m sure this is the result of something silly I’m doing, but I cannot work out what. Any hints about where to look?

ROOT Version: 6.24/06
Platform: NAME=“CentOS Linux” VERSION=“7 (Core)” ID_LIKE=“rhel fedora” CLUSTER=“sunrise”
Compiler: using GNU Make 3.82, which presumably calls g++ (GCC) 11.2.0 under the hood.

You meant:

  ClassDef(VNetworkBase, 1);

i.e. no quotes.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.