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 {
public:
  // Constructors
  VNetworkBase();
  explicit VNetworkBase(const std::string &inputFile);
  VNetworkBase(const VNetworkBase &copy_from);
  //destructor
  virtual ~VNetworkBase();
  
  typedef std::map<std::string, int> NetworkIO;
  virtual NetworkIO compute(NetworkIO inputs) = 0;

  // Other stuff....

private:
  
  // 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/cern.ch/user/h/hdayhall/private/qualification/FastCaloSim/FCSParametrization/athena/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_F$
stCaloSimEvent/LinkDef.h:47:
In file included from /afs/cern.ch/user/h/hdayhall/private/qualification/FastCaloSim/FCSParametrization/athena/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_F$
stCaloSimEvent/TFCSGANEtaSlice.h:22:
/afs/cern.ch/user/h/hdayhall/private/qualification/FastCaloSim/FCSParametrization/athena/Simulation/ISF/ISF_FastCaloSim/ISF_FastCaloSimEvent/ISF_FastCaloSimEvent/VNetwo$
kBase.h:274:12: error: cannot initialize return object of type 'TClass *' with an lvalue of type 'const char [13]'
  ClassDef("VNetworkBase", 1);
           ^~~~~~~~~~~~~~
/cvmfs/atlas.cern.ch/repo/sw/software/22.0/sw/lcg/releases/LCG_101_ATLAS_20/ROOT/6.24.06a/x86_64-centos7-gcc11-opt/include/Rtypes.h:326:22: note: expanded from macro 'C$
assDef'
   _ClassDefOutline_(name,id,virtual,)               \
                     ^~~~
/cvmfs/atlas.cern.ch/repo/sw/software/22.0/sw/lcg/releases/LCG_101_ATLAS_20/ROOT/6.24.06a/x86_64-centos7-gcc11-opt/include/Rtypes.h:300:19: note: expanded from macro '_$
lassDefOutline_'
   _ClassDefBase_(name,id, virtual_keyword, overrd)       \
                  ^~~~
/cvmfs/atlas.cern.ch/repo/sw/software/22.0/sw/lcg/releases/LCG_101_ATLAS_20/ROOT/6.24.06a/x86_64-centos7-gcc11-opt/include/Rtypes.h:291:56: note: expanded from macro '_C
lassDefBase_'
   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.