[odb-users] Possible #include bug in generated code

Per Edin info at peredin.com
Sun Sep 1 14:59:48 EDT 2013


Hi,

When generating the schema separately in a static multi-database
configuration the generated schema source file does not compile. The
compiler gives an error about the "invalid use of incomplete type
class odb::database'.

I discovered that in static mode the generated inline file
person-odb.ixx omits to include odb/database.hxx. In dynamic mode the
#include-line is present.

A workaround is to use --cxx-prologue but a long-term solution would
be to make the odb compiler emit

    #include <odb/database.hxx>

to the top of person-schema-DB.cxx file directly.

ODB commands used:

odb --generate-schema --schema-format separate --std c++11 -m static
-d common -d pgsql person.hxx

odb --generate-schema --schema-format separate --std c++11 -m dynamic
-d common -d pgsql person.hxx

Replace pgsql with sqlite and the problem remains. None of the
separately generated schema source files include odb/database.hxx on
their own.

/Per



More information about the odb-users mailing list