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

来源:互联网 发布:ie修复软件绿色版 编辑:程序博客网 时间:2024/06/14 01:39

昨天为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?
  1. //////////////////////////////////////////////////////////////////////////  
  2. //   
  3. // We must comment here, because WinCE doesn't have localtime_r and  
  4. // localtime_s. ---Brian Liu, 2010-07-22   
  5. //   
  6. //////////////////////////////////////////////////////////////////////////  
  7.   
  8.   
  9. //#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && /  
  10. //     defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE)  
  11. //#define HAVE_LOCALTIME_S 1   
  12. //#endif  

 


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

 

9. 编译。

 

原文地址:

点击打开链接
原创粉丝点击