After compiling Libodb with the official GCC4.7.2 of MinGW, and using ODB compiler to generate ODB "package" code for the Hello example, the compile link will never pass, and the following is the compile Example/hello error message as follows:
Libodb-sqlite-2.3.0/odb/sqlite-o Driver.exe DRIVER.O Person-odb.o-lodb-sqlite-lboost_date_time-lboost_system-lodb
libtool:link:g++-i/d/odb-sqlite/sqlite-amalgamation-3080200-mthreads-o. Libs/driver.exe driver.o person-odb.o-l/d /odb-sqlite/sqlite-amalgamation-3080200-l/d/odb-sqlite/libodb-2.3.0/odb-l/d/odb-sqlite/libodb-sqlite-2.3.0/odb /sqlite/d/odb-sqlite/libodb-sqlite-2.3.0/odb/sqlite/.libs/libodb-sqlite.a-lsqlite3-lboost_date_time-lboost_ System/d/odb-sqlite/libodb-2.3.0/odb/.libs/libodb.dll.a-mthreads-l/usr/local/lib
Driver.o:driver.cxx: (. Text$_zn3odb6sqlite11query_paramc2epkv[__zn3odb6sqlite11qu
ERY_PARAMC2EPKV]+0X1B): Undefined reference to ' _IMP___ZTVN3ODB6SQLITE11QUERY_PA
RamE '
Driver.o:driver.cxx: (. Text$_zn3odb6sqlite10query_basec1epkcs3_[__zn3odb6sqlite10
query_basec1epkcs3_]+0x5f): Undefined reference to ' _imp___zn3odb6sqlite10query_
Base6appendepkcs3_ '
d:/lbe/mingw/bin/. /lib/gcc/mingw32/4.7.2/. /.. /.. /.. /mingw32/bin/ld.exe:driver
. O:bad reloc address 0x5f in section '. text$_zn3odb6sqlite10query_basec1epkcs3_
[__zn3odb6sqlite10query_basec1epkcs3_] '
Collect2.exe:error:ld returned 1 exit status
MAKE[1]: * * * [Driver.exe] Error 1
MAKE[1]: Leaving directory '/d/lbe/oscode/odb-sqlite/odb-examples-2.3.0/hello '
Make: * * * [ALL] Error 2
Try a variety of methods can not be resolved, found in the ODB compiler directory with a MinGW compiler, this compiled version is GCC4.7.3, gcc-v output information is as follows:
Using built-in specs.
collect_gcc=d:\wxwidgets\wxcode\odb-2.3.0-i686-windows\mingw\bin\gcc
. exe
Collect_lto_wrapper=d:/wxwidgets/wxcode/odb-2.3.0-i686-windows/mingw
/bin/. /libexec/gcc/i686-w64-mingw32/4.7.3/lto-wrapper.exe
Target:i686-w64-mingw32
Configured with:.. /gcc/configure--host i686-w64-mingw32--target i686-w64-ming
W32--prefix=/mingw--with-sysroot=/mingw--enable-languages=c,c++--enable-shar
Ed--enable-threads=posix--DISABLE-LIBSSP--disable-libgomp--disable-graphite
--disable-multilib--enable-libstdcxx-time--enable-fully-dynamic-string--disab
Le-dw2-exceptions--enable-sjlj-exceptions--disable-libstdcxx-pch--disable-lib
Stdcxx-debug--disable-rpath--disable-win32-registry--disable-nls--disable-we
Rror--with-pkgversion= ' ODB special '--with-bugurl=http://www.codesynthesis.com/
products/odb/--enable-static-plugin--WITH-STAGE1-LIBS=LIBPLUGIN-STUB.A cflags=
-o2 Cxxflags=-o2 Ldflags=-s
Thread Model:posix
GCC version 4.7.3 20130209 (prerelease) (ODB special)
?
The output information of the MinGW GCC4.7.2 gcc-v is as follows:
Using built-in specs.
Collect_gcc=d:\mingw\bin\gcc.exe 
collect_lto_wrapper=d:/mingw/bin/.. /libexec/gcc/mingw32/4.7.2/lto-wrapper.ex 
E 
Target:mingw32 
Configured with:.. /gcc-4.7.2/configure--enable-languages=c,c++,ada,fortran,obj 
C, obj-c++--disable-sjlj-exceptions--with-dwarf2--enable-shared--enable-libgo
MP--disable-win32-registry--enable-libstdcxx-debug--disable-build-poststage1- 
With-cxx--enable-version-specific-runtime-libs--build=mingw32--prefix=/mingw< Span class= "Apple-converted-space" >&NBSP;
Thread model:win32&NBSP;
GCC Version 4.7.2 (GCC) &NBSP;
Now use the MinGW of ODB compiler to complete all the process of compiling the link, and record all the process of compiling,
The steps are:
(1) Compiling SQLite
Gcc-c sqlite3.c
Ar crvs libsqlite3.a sqlite3.o
(2) Compiling Libodb
./configure & Make
(3) Compiling libodb-sqlite
./configure cxxflags=-i/d/odb-sqlite/sqlite-amalgamation-3080200 ldflags=-l/d/odb-sqlite/ sqlite-amalgamation-3080200--with-libodb=/d/odb-sqlite/libodb-2.3.0
(4) Compiling libodb-example
./configure cxxflags=-i/d/odb-sqlite/sqlite-amalgamation-3080200 ldflags=-l/d/odb-sqlite/ sqlite-amalgamation-3080200--with-libodb=/d/odb-sqlite/libodb-2.3.0 Odb=/d/odb-2.3.0-i686-windows/bin/odb.exe-- With-database=sqlite--with-libodb-sqlite=/d/odb-sqlite/libodb-sqlite-2.3.0
Make
It is correct to start the test program under Example/hello and use the Sqliteadmin software to view the data in the database file.
$./driver--database hello.db--create
Hello, John doe!.
Hello, Jane doe!
Count:3
Min age:31
Max Age:33
ODB (c + + ORM) full compilation process with MinGW