码迷,mamicode.com
首页 > 数据库 > 详细

[odb-users] Create schema error (unknown database schema '')

时间:2017-08-07 00:12:13      阅读:308      评论:0      收藏:0      [点我收藏+]

标签:user   trigger   ++   exe   sep   code   list   write   iss   

Boris Kolpackov boris at codesynthesis.com 
Fri May 31 11:13:02 EDT 2013

 


Hi Andrey,

Andrey Devyatka <an9bit at gmail.com> writes:

> Please tell me, can I use the static library in the following case:
>> [...]

This is exactly the same issue that we‘ve discussed just a few days
ago:

http://www.codesynthesis.com/pipermail/odb-users/2013-May/001286.html

Because your application doesn‘t directly reference any symbols from
library-odb.cxx, the linker ignores library-odb.o from library.a. As
a result the schema creation code does not end up in the executable.

Normally this is not a problem since most application executables
will also include code that persists objects, etc., which will
force the linker to include all the object files from the library.

In your test, however, all you do is create the schema. As mentioned
in the above email, with GNU ld you can use the --whole-archive
option to force the linker to include every object file from your
static library:


> $ g++ -o test2 main.o library.a -lodb-sqlite -lodb

g++ -o test2 main.o -Wl,-whole-archive library.a -Wl,-no-whole-archive -lodb-sqlite -lodb

Another thing that you may find useful is the ‘separate‘ value for
the --schema-format option. It will trigger the generation of the
schema creation code as a separate C++ source file (library-schema.cxx).
You can then perhaps link it directly to your executable instead of
packaging it into a static library. See the ODB compiler command line
documentation (man pages) for more information on this option.

Boris


 

from:http://www.codesynthesis.com/pipermail/odb-users/2013-May/001299.html

[odb-users] Create schema error (unknown database schema '')

标签:user   trigger   ++   exe   sep   code   list   write   iss   

原文地址:http://www.cnblogs.com/lidabo/p/7296399.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!