您的位置:首页 > 数据库

转帖:为WinCE平台编译SQLite3.7动态库

2012-03-28 17:27 591 查看
昨天为WinCE平台编译了一份SQLite3.7动态库。

1. 在SQLite网站下载最新代码,推荐使用amalgamation 版本。

2. VS2005建立智能设备Win32DLL工程

3. 导入代码(除了shell.c)

4. 选中项目(而不是文件),项目->属性->C/C++->预编译头-> 创建/使用预编译头: 选择不使用预编译头。

5. 选中项目(而不是文件),项目->属性->链接器->输入-> 模块定义文件: 输入“sqlite3.def”。

6. 增加一个预定义宏 SQLITE_ENABLE_COLUMN_METADATA,否则链接出现以下错误。

sqlite3.def : error LNK2001: 无法解析的外部符号 sqlite3_column_database_name

sqlite3.def : error LNK2001: 无法解析的外部符号 sqlite3_column_database_name16

sqlite3.def : error LNK2001: 无法解析的外部符号 sqlite3_column_origin_name

sqlite3.def : error LNK2001: 无法解析的外部符号 sqlite3_column_origin_name16

sqlite3.def : error LNK2001: 无法解析的外部符号 sqlite3_column_table_name

sqlite3.def : error LNK2001: 无法解析的外部符号 sqlite3_column_table_name16

sqlite3.def : error LNK2001: 无法解析的外部符号 sqlite3_table_column_metadata

7. 注释掉以下部分:

[cpp]
view plaincopyprint?

//////////////////////////////////////////////////////////////////////////
//
// We must comment here, because WinCE doesn't have localtime_r and
// localtime_s. ---Brian Liu, 2010-07-22

//
//////////////////////////////////////////////////////////////////////////

//#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && /
// defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
//#define HAVE_LOCALTIME_S 1

//#endif

//////////////////////////////////////////////////////////////////////////
//
// We must comment here, because WinCE doesn't have localtime_r and
// localtime_s. ---Brian Liu, 2010-07-22
//
//////////////////////////////////////////////////////////////////////////

//#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && /
// defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)
//#define HAVE_LOCALTIME_S 1
//#endif

8. 增加函数定义struct tm *__cdecl localtime(const time_t *t); 在函数体static sqlite3_int64 localtimeOffset(DateTime *p)之前。

9. 编译。

原文地址:

点击打开链接
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: