[odb-users] Couldn't find method odb::database::id

Boris Kolpackov boris at codesynthesis.com
Thu Jan 27 10:04:56 EST 2022

Andy S <gatekeeper.mail at gmail.com> writes:

> /usr/bin/odb --multi-database dynamic -d common --generate-query
> --generate-session --generate-schema --generate-prepared --std c++11
> --output-dir ./odb_gen --hxx-suffix .hxx --ixx-suffix .ixx --cxx-suffix
> .cpp --odb-file-suffix common:_odb -I/usr/include ./model/invType/InvType.h
> [...]
> The code is compiled and linked without errors. When I run this code I
> receive SIGSEGV
> Program received signal SIGSEGV, Segmentation fault.
> odb::access::object_traits_impl<InvType, (odb::database_id)5>::query
> (db=..., q=...) at ./odb_gen/InvType_odb.ixx:94
> 94    return function_table[db.id ()]->query (db, q);

My guess would be you haven't generated and/or linked into your
application the database support code for each concrete database
you want to support in the dynamic mode (and, as a result, the
corresponding function table entry is NULL and thus SIGSEGV).
This is covered in the introduction to Chapter 16, "Multi-
Database Support" in the ODB manual.

More information about the odb-users mailing list