[odb-users] create_schema - compile error

lemonnierk at ulrar.net lemonnierk at ulrar.net
Tue Mar 18 05:55:49 EDT 2014


Hi,

I started looking into odb a few days ago, and I decided to give it a try.
I used the binary packages on the download page to install it. I am trying to use SQlite.

When I try to use the function schema_catalog::create_schema(db) as seen in the examples, I get this

In file included from /devdir/main.cpp:26:0:
/usr/local/include/odb/schema-catalog.hxx: In static member function ‘static void odb::schema_catalog::data_migration_function(odb::database&, odb::schema_catalog::data_migration_function_type, const string&)’:
/usr/local/include/odb/schema-catalog.hxx:105:43: error: invalid use of incomplete type ‘class odb::database’
In file included from /usr/local/include/odb/transaction.hxx:13:0,
                 from /devdir/main.cpp:25:
/usr/local/include/odb/forward.hxx:33:9: error: forward declaration of ‘class odb::database’
In file included from /devdir/main.cpp:26:0:
/usr/local/include/odb/schema-catalog.hxx: In static member function ‘static void odb::schema_catalog::data_migration_function(odb::database&, odb::schema_version, odb::schema_catalog::data_migration_function_type, const string&)’:
/usr/local/include/odb/schema-catalog.hxx:150:34: error: invalid use of incomplete type ‘class odb::database’
In file included from /usr/local/include/odb/transaction.hxx:13:0,
                 from /devdir/main.cpp:25:
/usr/local/include/odb/forward.hxx:33:9: error: forward declaration of ‘class odb::database’
In file included from /devdir/main.cpp:26:0:
/usr/local/include/odb/schema-catalog.hxx: In static member function ‘static odb::schema_version odb::schema_catalog::base_version(const odb::database&, const string&)’:
/usr/local/include/odb/schema-catalog.hxx:176:30: error: invalid use of incomplete type ‘const class odb::database’
In file included from /usr/local/include/odb/transaction.hxx:13:0,
                 from /devdir/main.cpp:25:
/usr/local/include/odb/forward.hxx:33:9: error: forward declaration of ‘const class odb::database’
In file included from /devdir/main.cpp:26:0:
/usr/local/include/odb/schema-catalog.hxx: In static member function ‘static odb::schema_version odb::schema_catalog::current_version(const odb::database&, const string&)’:
/usr/local/include/odb/schema-catalog.hxx:187:33: error: invalid use of incomplete type ‘const class odb::database’
In file included from /usr/local/include/odb/transaction.hxx:13:0,
                 from /devdir/main.cpp:25:
/usr/local/include/odb/forward.hxx:33:9: error: forward declaration of ‘const class odb::database’
In file included from /devdir/main.cpp:26:0:
/usr/local/include/odb/schema-catalog.hxx: In static member function ‘static odb::schema_version odb::schema_catalog::next_version(const odb::database&, odb::schema_version, const string&)’:
/usr/local/include/odb/schema-catalog.hxx:202:30: error: invalid use of incomplete type ‘const class odb::database’
In file included from /usr/local/include/odb/transaction.hxx:13:0,
                 from /devdir/main.cpp:25:
/usr/local/include/odb/forward.hxx:33:9: error: forward declaration of ‘const class odb::database’
In file included from /devdir/main.cpp:26:0:
/usr/local/include/odb/schema-catalog.hxx:202:49: error: invalid use of incomplete type ‘const class odb::database’
In file included from /usr/local/include/odb/transaction.hxx:13:0,
                 from /devdir/main.cpp:25:
/usr/local/include/odb/forward.hxx:33:9: error: forward declaration of ‘const class odb::database’
In file included from /devdir/main.cpp:26:0:
/usr/local/include/odb/schema-catalog.hxx: In static member function ‘static bool odb::schema_catalog::exists(const odb::database&, const string&)’:
/usr/local/include/odb/schema-catalog.hxx:218:24: error: invalid use of incomplete type ‘const class odb::database’
In file included from /usr/local/include/odb/transaction.hxx:13:0,
                 from /devdir/main.cpp:25:
/usr/local/include/odb/forward.hxx:33:9: error: forward declaration of ‘const class odb::database’
In file included from /devdir/main.cpp:31:0:
/devdir/build/ClassToPersist-odb.ixx: At global scope:
/devdir/build/ClassToPersist-odb.ixx:12:3: error: redefinition of ‘static odb::access::object_traits<ClassToPersist>::id_type odb::access::object_traits<ClassToPersist>::id(const object_type&)’
In file included from /devdir/build/ClassToPersist-odb.hxx:292:0,
                 from /devdir/main.cpp:30:
/devdir/build/ClassToPersist-odb.ixx:12:3: error: ‘static odb::access::object_traits<ClassToPersist>::id_type odb::access::object_traits<ClassToPersist>::id(const object_type&)’ previously defined here
In file included from /devdir/main.cpp:31:0:
/devdir/build/ClassToPersist-odb.ixx:19:8: error: redefinition of ‘static void odb::access::object_traits<ClassToPersist>::callback(odb::database&, odb::access::object_traits<ClassToPersist>::object_type&, odb::callback_event)’
In file included from /devdir/build/ClassToPersist-odb.hxx:292:0,
                 from /devdir/main.cpp:30:
/devdir/build/ClassToPersist-odb.ixx:19:8: error: ‘static void odb::access::object_traits<ClassToPersist>::callback(odb::database&, odb::access::object_traits<ClassToPersist>::object_type&, odb::callback_event)’ previously defined here
In file included from /devdir/main.cpp:31:0:
/devdir/build/ClassToPersist-odb.ixx:28:8: error: redefinition of ‘static void odb::access::object_traits<ClassToPersist>::callback(odb::database&, const object_type&, odb::callback_event)’
In file included from /devdir/build/ClassToPersist-odb.hxx:292:0,
                 from /devdir/main.cpp:30:
/devdir/build/ClassToPersist-odb.ixx:28:8: error: ‘static void odb::access::object_traits<ClassToPersist>::callback(odb::database&, const object_type&, odb::callback_event)’ previously defined here
In file included from /devdir/main.cpp:31:0:
/devdir/build/ClassToPersist-odb.ixx:43:8: error: redefinition of ‘static void odb::access::object_traits_impl<ClassToPersist, (odb::database_id)1u>::erase(odb::database&, const object_type&)’
In file included from /devdir/build/ClassToPersist-odb.hxx:292:0,
                 from /devdir/main.cpp:30:
/devdir/build/ClassToPersist-odb.ixx:43:8: error: ‘static void odb::access::object_traits_impl<ClassToPersist, (odb::database_id)1u>::erase(odb::database&, const object_type&)’ previously defined here
In file included from /devdir/main.cpp:31:0:
/devdir/build/ClassToPersist-odb.ixx:52:8: error: redefinition of ‘static void odb::access::object_traits_impl<ClassToPersist, (odb::database_id)1u>::load_(odb::access::object_traits_impl<ClassToPersist, (odb::database_id)1u>::statements_type&, odb::access::object_traits<ClassToPersist>::object_type&, bool)’
In file included from /devdir/build/ClassToPersist-odb.hxx:292:0,
                 from /devdir/main.cpp:30:
/devdir/build/ClassToPersist-odb.ixx:52:8: error: ‘static void odb::access::object_traits_impl<ClassToPersist, (odb::database_id)1u>::load_(odb::access::object_traits_impl<ClassToPersist, (odb::database_id)1u>::statements_type&, odb::access::object_traits<ClassToPersist>::object_type&, bool)’ previously defined here
72 /devdir/main.cpp: In function ‘int main(int, char**)’:
73 /devdir/main.cpp:42:3: error: ‘schema_catalog’ has not been declared
74 make[3]: *** [CMakeFiles/testprog.dir/main.cpp.o] Error 1
75 make[3]: Leaving directory `/devdir/build'
76 make[2]: *** [CMakeFiles/testprog.dir/all] Error 2
77 make[2]: Leaving directory `/devdir/build'
78 make[1]: *** [all] Error 2     



I am using a CMakeLists.txt found on github to compile both odb and Qt, worked fine until I added the schema.
I saw an old mail here with, I believe, the same errors, and the answer was that it was fixed in the next version.
Does the version on the website still have a bug for that ? Or am I just missing something.
I do include both ClassToPersist.hpp and ClassToPersist-odb.hxx in my main.cpp file, and the -odb files are generated and compiled.

Thanks
-- 
Kevin Lemonnier
PGP Fingerprint : C123 47CA 9E64 FCF0 3907
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
Url : http://codesynthesis.com/pipermail/odb-users/attachments/20140318/2939eb13/attachment.pgp


More information about the odb-users mailing list