Std::runtime_error with only non-default constructor

#include <stdexcept>

class SingularMatrix : public std::runtime_error
{
public :
SingularMatrix() 
    : runtime_error("matrix is singular") {}; 
};

error:

TestMatrix_C_ACLiC_dict.cxx:37: error: base `std::runtime_error' with only non-default constructor in class without a constructor

what’s the problem here? How to solve it? Why all these problems compiling with ROOT? I want to use all the feautures of C++ not only the ones ROOT likes. And after all SingularMatrix::SingularMatrix() is a default constructor!

Hi,

please use ClassDef(SingularMatrix, 2) if you do want to do I/O with objects of this type, or ClassDef(SingularMatrix, 0) if you don’t use I/O, or #pragma link C++ class SingularMatrix-; which disables I/O, too.

Cheers, Axel.

[quote=“Axel”]Hi,

please use ClassDef(SingularMatrix, 1) if you do want to do I/O with objects of this type, or SingularMatrix(SingularMatrix, 0) if you don’t use I/O, or #pragma link C++ class SingularMatrix-; which disables I/O, too.

Cheers, Axel.[/quote]

Ok, thanks, but I continue to don’t understand why ROOT think by default that I want to do I/O with a custom class. This class is used only to throw exceptions!

In general I think that you must specify something (Classdef or what you want) if you want do to some I/O, but not the contrary. Why do I need to specify that I don’t want to do I/O ?

[quote]but I continue to don’t understand why ROOT think by default that I want to do I/O with a custom class.[/quote]ROOT in general does not. In the general case, you need to write a linkdef file explicitly requested what you need/want and run rootcint explicitly. When using ACLiC, we choose the default to be to enable the I/O which is, in our experience, what is needed in most case … in addition, enabling the I/O is … in most cases :slight_smile: … harmless.

Cheers,
Philippe.