[odb-users] Intermittent problems building solution

Boris Kolpackov boris at codesynthesis.com
Thu Jul 18 04:56:11 EDT 2013


Hi Adam,

Adam Walters <adam at navigatesurgical.com> writes:

> Further examination showed it to be caused by a missing override in the
> derived class

Ok, that explains it. What happens is this: because your derived class
still has pure virtual functions, ODB treats it as abstract. And since
a (reuse-) abstract class cannot be queried for, ODB doesn't generate
any of the query machinery.


> (this would normally cause a 'can't instantiate abstract class' error
> message).

You would still get it if your code tried to instantiate the class.


> The ODB compile doesn't complain that the derived class doesn't
> implement all of the abstract base class methods;

ODB doesn't know your intentions: did you not override the functions
on purpose (and therefore the class should be treated as abstract) or
did you forget? ODB treats the class as abstract if it is abstract in
C++ sense (i.e., has pure virtual functions) or is explicitly marked
abstract.

The only way to fix this that I can see is to always require ODB-abstract
classes to be explicitly marked with the pragma. This way the ODB compiler
will be able to complain if it sees a C++-abstract class that is not
explicitly marked.


> At least I know what causes it now. Hopefully this will be of use
> to others who encounter the same problem.

Yes, definitely. Thanks for sharing this!

Boris



More information about the odb-users mailing list