返回> 网站首页 

用VC2008编译SQLITE

yoours2011-09-22 13:09:23 阅读 1307

简介一边听听音乐,一边写写文章。

一、下载
sqlite-amalgamation-3070800.zip           将多个文件合并成了一个。
    This ZIP archive contains all C source code for SQLite 3.7.8 combined into a single source file (the amalgamation).

sqlite-preprocessed-3070800.zip           不合并文件,独立。
    This ZIP archive contains preprocessed C code for SQLite version 3.7.8 individual source files. The use of this source distribution is not recommended. Use one of the amalgamation packages above unless you have a compelling reason not to.

这里选择 sqlite-preprocessed-3070800.zip 压缩包。

二、编译
  1. 创建空的Win32 DLL工程。
          将.c和.h文件加入到工程中,将tclsqlite.c和icu.c从工程中移除。
   2. 将编译模式改为c模式(TC)。
          Project->Properties->Configuration Properties->C/C++->Advanced->Compile As
   3. 如果想要取得不必要的警告信息,则作如下处理:
   4. 为了消除 C1189 错误
          Project->Properties->Configuration Properties->C/C++->Preprocessor->Preprocessor Definitions
   预定义:
          SQLITE_ENABLE_BROKEN_FTS2
          SQLITE_ENABLE_BROKEN_FTS1
          SQLITE_CORE
    5. 设置DLL导出函数
        修改SQLITE_API
        #define DllImport __declspec(dllimport)
        #define DllExport __declspec(dllexport)

        #ifndef SQLITE_API
                    # define SQLITE_API DllExport
        #endif
    6. 编译即可

三、调试
    增加编译的调试信息,才可以调试。
    Project->Properties->Configuration Properties->Linker->Debugging
         Generate Debug Info选择 Yes(/DEBUG)

微信小程序扫码登陆

文章评论

1307人参与,0条评论