[odb-users] Error creating static library from ODB generated files

Boris Kolpackov boris at codesynthesis.com
Fri Apr 3 10:27:48 EDT 2015


Hi Nicholas,

Nicholas Cremonesi <nicholas.cremonesi at gmail.com> writes:

> I'm trying to compile my generated "-odb.o" files into a static library
> ('.a') under Windows using MinGW, but when I link to the generated library
> my compiler crashes with lot of errors like this:
> 
> "./libtest.a(MyClass-odb.o):MyClass-odb.cxx:(.text+0xdac): undefined
> reference to `_imp___ZN3odb6sqlite11transaction7currentEv'" ecc..

First of all, the compiler does not crash. It issues diagnostics and
exist with an error code. That's not the same as "crash".

The error in question is an undefined symbol that points to the
libodb-sqlite runtime. So you are either not linking this library
or you are linking it in an incorrect order. In particular, it
should be linked after your libtest.a, e.g.,

... libtest.a -lodb-sqlite -lodb

I also suggest that you google and read up on static libraries
and link order.

Boris



More information about the odb-users mailing list