[odb-users] Linux Linking ODB - libtool vs g++

Szumowski, Thomas thomas.szumowski at lmco.com
Mon Aug 29 12:24:19 EDT 2011


I was following the example in the ODB user manual section 2.3 "Compiling and Running". I am on a linux machine. I noticed when I get to the point of running the equivalent command "c++ -o driver driver.o person-odb.o -lodb-mysql -lodb", I get an error. But when I run the make in the examples (hello), it runs libtool and I get no errors. See below for my results. First I link using libtool, as done in the makefile. That works fine and I can execute the program. But then I try the line in the user manual and it fails. Any recommendations? And should I just always use libtool to build?

-----------------------------------
OUTPUT
-----------------------------------

[user at localhost tmp]$ ../../libtool --tag=CXX   --mode=link g++  -g -O2    -o driver driver.o person-odb.o  -lodb-sqlite -lodb  -lpthread
libtool: link: g++ -g -O2 -o driver driver.o person-odb.o  /usr/local/lib/libodb-sqlite.so /usr/local/lib/libodb.so -lpthread -Wl,-rpath -Wl,/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib
[user at localhost tmp]$ ls
database.hxx  driver  driver.cxx  driver.o  person.hxx  person-odb.cxx  person-odb.hxx  person-odb.ixx  person-odb.o
[user at localhost tmp]$ ./driver
Hello, John Doe!
Hello, Jane Doe!
[user at localhost tmp]$ g++ -o driver driver.o person-odb.o -lodb-sqlite -lodb
/usr/local/lib/libodb-sqlite.so: undefined reference to `sqlite3_open_v2'
/usr/local/lib/libodb-sqlite.so: undefined reference to `sqlite3_extended_errcode'
/usr/local/lib/libodb-sqlite.so: undefined reference to `sqlite3_prepare_v2'
collect2: ld returned 1 exit status

-----------------------------------






-Tom



More information about the odb-users mailing list