好,可以开始编译了,右击sqlite3,选择“生成”,结果链接出错,
—— 已启动生成: 项目: sqlite3, 配置: Release Win32 —— 正在编译… sqlite3.c 正在链接… 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
看来sqlite3.def 中定义的这几个导出函数找不到定义,什么原因呢,经过一番google,找到这篇文章 ,需要增加一个预定义宏 SQLITE_ENABLE_COLUMN_METADATA,这个宏是什么意思呢,到官网 去查一下,SQLITE_ENABLE_COLUMN_METADATA When this C-preprocessor macro is defined, SQLite includes some additional APIs that provide convenient access to meta-data about tables and queries. The APIs that are enabled by this option are: * sqlite3_column_database_name() * sqlite3_column_database_name16() * sqlite3_column_table_name() * sqlite3_column_table_name16() * sqlite3_column_origin_name() * sqlite3_column_origin_name16() * sqlite3_table_column_metadata()
原来是只有当启用了这个宏后,c代码中才会后这几个函数的定义,OK,在预处理器中添加 SQLITE_ENABLE_COLUMN_METADATA,如下图所示。
再来编译,搞定!