[odb-users] compile error with Cygwin about hello world example

Boris Kolpackov boris at codesynthesis.com
Mon Nov 22 08:59:29 EST 2010


Hi Myoungkyu,

Myoungkyu Song <mksong at vt.edu> writes:

> I can't compile the example with Cygwin.
>
> /home/smk/odb/libodb-mysql/lib/:
> rwxr-xr-x  smk:None     0  Nov 19 20:04  pkgconfig/
> rw-r--r--  smk:None  1.2M  Nov 19 20:04  libodb-mysql.a
> rwxr-xr-x  smk:None    1K  Nov 19 20:04  libodb-mysql.la
> 
> /home/smk/odb/libodb/lib/:
> rwxr-xr-x  smk:None    0  Nov 19 13:12  pkgconfig/
> rwxr-xr-x  smk:None  55K  Nov 19 13:12  libodb.dll.a
> rwxr-xr-x  smk:None  953  Nov 19 13:12  libodb.la

You have libodb built as a DLL while libodb-mysql and, I assume,
libmysqclient_r as static libraries. First, rebuild libodb as a
static library (pass --disable-shared to configure).

> g++ driver.o person-odb.o -o driver \
> -L. \
> -L/home/smk/odb/libodb/lib \
> -L/home/smk/odb/libodb-mysql/lib \
> -lodb -lodb-mysql

Once this is done, change the last line in the above link command
to read:

-lodb-mysql -lodb -lmysqlclient_r

When linking static libraries, the order is important.

Boris



More information about the odb-users mailing list