由于需要sqlite的x64版本只能自己编译,下载sqlite源代码、sqlite.def。Visual Studio 2013新建一个Visual C++ Empty Project,Configuration Type设置为Dynamic Library (.dll)。Linker -> Input -> Module Definition File设置为sqlite3.def。考虑Windows XP的兼容性,将Platform Toolset设置为Visual Studio 2010 (v100)。编译时会有以下两个相关错误:
1、fatal error LNK1120: 7 unresolved externals
1>Linking... 1>sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_database_name 1>sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_database_name16 1>sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_origin_name 1>sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_origin_name16 1>sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_table_name 1>sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_table_name16 1>sqlite3.def : error LNK2001: unresolved external symbol sqlite3_table_column_metadata
Preprocessor Definitions添加SQLITE_ENABLE_COLUMN_METADATA即可。
2、unresolved external symbol sqlite3_rtree_geometry_callback
Preprocessor Definitions添加SQLITE_ENABLE_RTREE即可。