[odb-users] gcc-5.4: cannot link code produced with odb
Vladimir Tsichevski
tsichevski at gmail.com
Tue Nov 29 10:21:12 EST 2016
Hi,
I'm trying to build the odb person example provided with the odb manual.
My system is Ubunti 16, odb-2.4, and the default compiler is gcc-5.4. I
got the following linking problems:
g++ -std=c++11 person.cpp person-odb.cxx main.cpp -lodb-pgsql -lodb
/tmp/cc9XRXgG.o: In function `odb::access::object_traits_impl<person,
(odb::database_id)2>::init(odb::access::object_traits_impl<person,
(odb::database_id)2>::image_type&, person const&,
odb::pgsql::statement_kind)':
person-odb.cxx:(.text+0x49b): undefined reference to
`odb::pgsql::default_value_traits<std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
(odb::pgsql::database_type_id)10>::set_image(odb::details::basic_buffer<char>&,
unsigned long&, bool&, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
person-odb.cxx:(.text+0x525): undefined reference to
`odb::pgsql::default_value_traits<std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
(odb::pgsql::database_type_id)10>::set_image(odb::details::basic_buffer<char>&,
unsigned long&, bool&, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&)'
/tmp/cc9XRXgG.o: In function `odb::access::object_traits_impl<person,
(odb::database_id)2>::query(odb::database&, odb::pgsql::query_base const&)':
person-odb.cxx:(.text+0x1754): undefined reference to
`odb::pgsql::query_base::clause[abi:cxx11]() const'
person-odb.cxx:(.text+0x184d): undefined reference to
`odb::pgsql::select_statement::select_statement(odb::pgsql::connection&,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, bool, bool,
unsigned int const*, unsigned long, odb::pgsql::native_binding&,
odb::pgsql::binding&)'
/tmp/cc9XRXgG.o: In function `odb::access::object_traits_impl<person,
(odb::database_id)2>::erase_query(odb::database&, odb::pgsql::query_base
const&)':
person-odb.cxx:(.text+0x1b2f): undefined reference to
`odb::pgsql::query_base::clause[abi:cxx11]() const'
person-odb.cxx:(.text+0x1be0): undefined reference to
`odb::pgsql::delete_statement::delete_statement(odb::pgsql::connection&,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> > const&, std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&, unsigned int
const*, unsigned long, odb::pgsql::native_binding&)'
collect2: error: ld returned 1 exit status
With gcc-5.4 this error appears regardless whether I use -std=c++11 or not.
But I can successfully link the object files if they were compiled with
gcc-4.8 on the same system:
g++-4.8 -std=c++11 person.cpp person-odb.cxx main.cpp -lodb-pgsql -lodb
Again, with gcc-4.8 I can successfully compile regardless whether I use
-std=c++11 or not.
Is there any workaround for this problem?
Regards,
Vladimir
PS: same problem appears if I try to build odb-examples-2.4.0 package
PS1: same problem appears if I try to use odb compiler build from sources
More information about the odb-users
mailing list