編譯sqlite3.dll時的問題

在vs2005命令行中使用如下命令編譯sqlite3.dll
html

  1. cl sqlite3.c /csql

  2. link sqlite3.obj /dll /def:sqlite3.def /implib:sqlite3.libspa

執行第二條命令時,發生錯誤:
命令行

  1. sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_database_namesqlite

  2. sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_database_name16htm

  3. sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_origin_nameget

  4. sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_origin_name16it

  5. sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_table_name編譯

  6. sqlite3.def : error LNK2001: unresolved external symbol sqlite3_column_table_name16table

  7. sqlite3.def : error LNK2001: unresolved external symbol sqlite3_rtree_geometry_callback

  8. sqlite3.def : error LNK2001: unresolved external symbol sqlite3_table_column_metadata

  9. sqlite3.lib : fatal error LNK1120: 8 unresolved externals

http://source.online.free.fr/Windows_HowToCompileSQLite.html找到了相關的資料。

在sqlite3.c中添加兩個宏定義

  1. #define SQLITE_ENABLE_RTREE

  2. #define SQLITE_ENABLE_COLUMN_METADATA

保存後,從新執行命令

  1. cl sqlite3.c /c

  2. link sqlite3.obj /dll /def:sqlite3.def /implib:sqlite3.lib

便可編譯成功

相關文章
相關標籤/搜索