[odb-users] ixx: error: no matching function for call to ‘odb::access::object_traits<Base>::id(const object_type&)’

Richard Topolewski topolewr at cooley.edu
Sun Nov 5 22:33:50 EST 2017


I have been struggling with the problem all day.  I can get various
different errors depending on what includes I do, but the crux of what I
believe I don't understand is why the compiling of a derived class
complains it can’t find some ODB functions that it needs regarding the base
class? In addition, I will mention that the derived class is to save
someone ODB persistent objects, the details of which are excluded because I
don't think they are relevant. If any further information is needed to help
flush out this problem please let me know, I can provide them.


-- Rich





I have a base class Base.cpp with #pragma db object polymorphic



and derived class is Base_plus.cpp with #pragma db object



when compiling Base_plus.cpp  it gives these error:




In file included from Base_plus-odb.hxx:396:0,

                 from Base_plus.h:25,

                 from Base_plus.cpp:11:

Base_plus-odb.ixx: In static member function ‘static
odb::access::object_traits<Base_plus>::id_type
odb::access::object_traits<Base_plus>::id(const object_type&)’:

Base_plus-odb.ixx:15:44: error: no matching function for call to
‘odb::access::object_traits<Base>::id(const object_type&)’

     return object_traits< ::Base >::id (o);

                                            ^

In file included from Base-odb.hxx:332:0,

                 from Base_plus-odb.hxx:22,

                 from Base_plus.h:25,

                 from Base_plus.cpp:11:

Base-odb.ixx:12:3: note: candidate: static
odb::access::object_traits<Base>::id_type
odb::access::object_traits<Base>::id(const object_type&)

   access::object_traits< ::Base >::

   ^

Base-odb.ixx:12:3: note:   no known conversion for argument 1 from ‘const
object_type {aka const Base_plus}’ to ‘const object_type& {aka const Base&}’


More information about the odb-users mailing list