[odb-users] Problem: Generated unfinished -odb.cxx with unimplemented pure virtual function

xuewen wang xuewen.ok at gmail.com
Tue May 14 11:14:36 EDT 2024


Compiler version: obd 2.5.0-b.25+1
Building environment: build2 on ubuntu 22.04.4LTS
GCC version: gcc 11.04

Issue: the odb compiler doesn't finish generating the -odb.cxx file
it stops after generating the init functions.
To reproduce the problem, compile the Persion.h with the following command
line:
odb --database sqlite --generate-query --generate-schema --std c++11
Persion.h

The Person.h file:
//=============================================
class Person {
public:
    virtual void test() = 0;
};


#pragma db object
class Student : public Person {
public:
    int id;
};
//=============================================

The tail of generated Persion-odb.cxx:
//=============================================
......
  void access::object_traits_impl< ::Student, id_sqlite >::
  init (object_type& o,
        const image_type& i,
        database* db)
  {
    ODB_POTENTIALLY_UNUSED (o);
    ODB_POTENTIALLY_UNUSED (i);
    ODB_POTENTIALLY_UNUSED (db);

    // id
    //
    {
      int& v =
        o.id;

      sqlite::value_traits<
          int,
          sqlite::id_integer >::set_value (
        v,
        i.id_value,
        i.id_null);
    }
  }
}

#include <odb/post.hxx>
//==============================================
Best regards...
---- Sean Wang (Xuewen Wang), Beijing, China.


More information about the odb-users mailing list