posts - 11,  comments - 0,  trackbacks - 0

Original link: http://news.thedigitalmachine.com/2007/03/28/set-up-sqlite-static-lib-and-a-c-wrapper-in-15-minutes/

sqlite is a sweet little answer to database storage for stand-alone applications. CppSQLite is the best C++ wrapper I found (NOTE: there are many). I didn’t find any quick instructions to get the C code statically linked into a Visual Studio 2005 C++ app, so here they are. At the end, I had all the code wrapped nicely into my application with a size increase of 132kb – and no dependencies! Whoop.

You can just grab the files here if you don’t care about the gory details. Read the included Readme.txt file for quick setup instructions. Everything you need is included, including v3.3.13 of the sqlite source and v3.1 of the CppSQLite files.

Now for the blow-by-blow setup of how to do the static library build yourself. It’s not brain surgery, but it’s good to know – for example, if you want to use a newer version of the source code (in case I get lazy and don’t update this).

  • create a new Visual Studio 2005 Win32 console application
  • during creation, under advanced options…
    - change build target type to “static library”
    - uncheck “precompiled header”
  • add NO_TCL to preprocessor definitions
    - Go here: Project->Properties->Configuration Properties->C/C++->Preprocessor->Preprocessor Definitions
    - Add NO_TCL to the existing lists of all configurations, to bypass inclusion of TCL support
  • change the runtime library (to match whatever project that will be linking to the sqlite library you build)
    - Found here: Project->Properties->Configuration Properties->C/C++->Code Generation->Runtime Library
  • download the preprocessed source code and add it to the project
  • (optional) disable the more neurotic VS8 warnings (even though you can safely ignore them)…
    - add _CRT_SECURE_NO_WARNINGS to preprocessor definitions:
    - – Go here: Project->Properties->Configuration Properties->C/C++->Preprocessor->Preprocessor Definitions
    - – Add _CRT_SECURE_NO_WARNINGS to the existing lists of all configurations
  • - disable the following warnings (Project->Properties->C/C++->Advanced->Disable Specific Warnings):
    - – 4267;4244;4018;4311;4996;4312;4311

  • compile!
  • include the resulting static library, along with the CppSQLite wrapper class, in your shiny new project
  • read about CppSQLite and write some code!
posted on 2010-04-30 16:39 SearchDream 阅读(366) 评论(0)  编辑 收藏 引用

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2010年4月>
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

常用链接

留言簿

随笔档案

搜索

  •  

最新评论

阅读排行榜

评论排行榜