[odb-users] linkage problems using mysql database

Amir Developer amir.thedev at gmail.com
Tue Jan 17 06:06:55 EST 2017


Hi,

I'm trying to compile and link the hello sample but with no luck.
Env: Ubuntu 16.04.1 LTS
Compiler: g++ 5.4.0
odb: installed through APT version 2.4.0
database: MySQL

Compiling the person.hxx works fine with the following line used:
odb -d mysql --generate-query --generate-schema person.hxx

4 files are generated as expected:
person-odb.cxx
person-odb.hxx
person-odb.ixx
person.sql

compiled everything with the following lines:
g++ -c person-odb.cxx
g++ -DDATABASE_MYSQL -c driver.cxx

the problem is when linking everything with the following line:
g++ -o driver driver.o person-odb.o -lodb-mysql -lodb

the error:
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libodb-mysql.so:
undefined reference to `odb::statement::process_insert(char const*, void
const* const*, unsigned long, unsigned long, char,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libodb-mysql.so:
undefined reference to `odb::statement::process_update(char const*, void
const* const*, unsigned long, unsigned long, char,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >&)'
/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libodb-mysql.so:
undefined reference to `odb::statement::process_select(char const*, void
const* const*, unsigned long, unsigned long, char, char, bool,
std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >&, bool)'
collect2: error: ld returned 1 exit status

tried a locally compiled version of odb-mysql.so too but that didn't help
same error

appreciate any help.

Thank you in advance,

Amir


More information about the odb-users mailing list