编译 SQLite3

[size=medium]
SQLite 官方提供的编译方法:
[url]http://www.sqlite.org/cvstrac/wiki?p=HowToCompile[/url]
[/size]

[quote]MSVC and SQLite DLL
Creation of an import library from the sqlitedll.zip (http://www.sqlite.org/sqlitedll.zip) for MS Visual C++ is achieved by the following command:

LIB /DEF:sqlite3.def

This makes the files sqlite3.lib and sqlite3.exp files. The sqlite3.lib can then be used to link your programs against the SQLite DLL.

If you are using Visual C++ 6.0, you might also want to check #3057 for ways to work around an optimizer bug in the compiler. [/quote]

[size=medium]

这样生成的静态库是需要 dll 文件的。所以我一直没明白官方提供的方法意义何在?

如果想要一个独立的 sqlite3.lib,可以这样做:
下载最新版本的 sqlite3 源代码,sqlite-amalgamation-3.x.xx.tar.gz。
sqlite3 源代码有好几个版本,amalgamation 版最适合集成到自己的工程中使用,它把所有的源代码都放入一个文件当中,在 sqlite3.c 这个含有 10 万多行代码的文件中包含了一切,直接编译它就可以生成一个独立的 sqlite3.lib。用 VC 编译:
[/size]

[quote]cl /c sqlite3.c //只编译不链接,生成 obj 文件

lib sqlite3.obj[/quote]

[size=medium]

用 GCC 编译的话方法类似
[/size]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值