[odb-users] Persisting class instantiated from a template
Balázs Bayer
balazs.bayer at gmail.com
Mon Mar 20 15:33:30 EDT 2017
Hi Boris,
you can get the source files via these links:
main.cpp <http://pastebin.com/9AcrSf0B>
result.hpp <http://pastebin.com/FU2vxWBS>
result-mapping.hpp <http://pastebin.com/sPBKuEaC>
I generate the support code and compile the whole propgram with these
commands:
odb --std c++11 -d sqlite -s --odb-epilogue '#include "result-mapping.hpp"'
--generate-query result.hpp
odb --std c++11 -d sqlite -s --generate-query result-mapping.hpp
clang++ -std=c++11 -c -o result-odb.o result-odb.cxx
clang++ -std=c++11 -c -o result-mapping-odb.o result-mapping-odb.cxx
clang++ -std=c++11 -c -o main.o main.cpp <= at this point I get the below
error message
clang++ -o fut main.o result-odb.o result-mapping-odb.o -lodb-sqlite -lodb
The error message is:
In file included from main.cpp:8:
In file included from ./result-odb.hxx:18:
In file included from ./result-mapping-odb.hxx:23:
/usr/include/odb/traits.hxx:178:5: error: implicit instantiation of
undefined template 'odb::access::object_traits_impl<result::Result<float,
7>, 5>'
access::object_traits_impl<T, DB>,
^
/usr/include/odb/database.txx:38:5: note: in instantiation of template
class 'odb::object_traits_impl<result::Result<float, 7>, 5>' requested here
object_traits::persist (*this, obj);
^
/usr/include/odb/database.ixx:160:12: note: in instantiation of function
template specialization 'odb::database::persist_<result::Result<float, 7>,
5>' requested here
return persist_<T, id_common> (obj);
^
main.cpp:25:9: note: in instantiation of function template specialization
'odb::database::persist<result::Result<float, 7> >' requested here
db->persist(S);
^
/usr/include/odb/forward.hxx:99:11: note: template is declared here
class object_traits_impl;
^
In file included from main.cpp:11:
In file included from /usr/include/odb/sqlite/database.hxx:16:
In file included from /usr/include/odb/database.hxx:632:
/usr/include/odb/database.txx:38:18: error: incomplete definition of type
'odb::object_traits_impl<result::Result<float, 7>, 5>'
object_traits::persist (*this, obj);
~~~~~~~~~~~~~^~
/usr/include/odb/database.ixx:160:12: note: in instantiation of function
template specialization 'odb::database::persist_<result::Result<float, 7>,
5>' requested here
return persist_<T, id_common> (obj);
^
main.cpp:25:9: note: in instantiation of function template specialization
'odb::database::persist<result::Result<float, 7> >' requested here
db->persist(S);
^
In file included from main.cpp:11:
In file included from /usr/include/odb/sqlite/database.hxx:16:
In file included from /usr/include/odb/database.hxx:632:
/usr/include/odb/database.txx:40:29: error: no member named
'reference_cache_traits' in 'odb::object_traits_impl<result::Result<float,
7>, 5>'
typename object_traits::reference_cache_traits::position_type p (
~~~~~~~~~~~~~~~^
3 errors generated.
Thanks,
Balazs
More information about the odb-users
mailing list