Building SQLite3 with Visual Studio 2005

Author: Rajinder Yadav
Date: Nov 24, 2007

Revised: Jan 12, 2008

I would like to thank George Rhoten and Roberto Padovani for taking the time to provide their feedback!

George Rhoten an ICU Developer gave me great feedback for making some corrections in my original article. As a result some project settings have been removed. He also suggests that the project setting for the ICU Library doesn't need to be changed, and one can simply tell the SQLite project where to find the libs. If you plan to keep up with the various ICU changes, then follow his advice.

I did things the way I did, because most likely you will download the source for ICU and SQLite so that your own project can use the SQLite database (I have a personal project that is using SQLite source before ICU was added as a requirement). Chances are slim you will keep updating the source for SQLite3 or ICU and risk your own project from breaking or have changes in these project introduce a bug in your project. Also you will not have to find and copy over the DLLs in order to be able to run your project's exe since my setup places all the DLLs into the same bin folder. Forgetting to copy over updated DLLs can be a source of needless debugging when things don't work right. The location for the bin and lib folders can be easily changed by making the changes to the environment variables.

Roberto Padovani provided me with some feedback for those using Visual C++ Express. If you plan to go this route he suggests you do these steps:

  1. download and install VC++ Express (free)
  2. download and install Microsoft Platform SDK (PSDK) (the Windows Server 2003 is ok for windows XP)
  3. setup the options in VC++ Express so that it knows in which directory the PSDK stored the .lib files
  4. follow your tutorial, plus adding the advapi32.lib in order to be able to build iuc*

(*) I do not use Visual Studio Express, so I am not the right person to ask for help on using this edition or getting setup. That's a topic outside the scope of this article.


The building of SQLite has gotten a bit more involved. You not only have to download the SQLite source code but also the ICU Unicode Library source code. There are many build steps outlined on the SQLite.org wiki, but I am not sure if they all have kept up to the changes that have been going on? As a result this guide was produced to tie any loose ends that I found seem to be missing from the various wiki pages. If you find errors, typos or omission please let me know so that I may keep this Guide up to date!

Step 1
If you haven't already done so you will need to download the latest SQLite source code from: http://sqlite.org. Go to the SQLite project website and click on the "Download" link. From there scroll down to Precompiled Binaries For Windows and download the package for the DLL binary with TCL binding (sqlitedll-3_5_4.zip at the time of writing). We will need to get the definition file sqlite3.def which is required to build the SQLite3 DLL.

I have no idea why the project team doesn't add this file to the source code download? If you plan to make a static library, you don't need to do this step.

 


Step 2
Next you will need to download the SQLite3 source code. Scroll down to the source code area and download the zipped file which contains the preprocessed C code. At the time of writing, the file is called sqlite-source-3_5_4.zip

 


Step 3
Before you can build the SQLite project you will also need to download the ICU Unicode Library. Go to the, "International Components for Unicode" project website at: http://icu-project.org/index.html

Click on the download link and download the latest "Official Release" source code in zipped format for the Windows platform. At the time of writting the latest file is icu4c-3_8_1-src.zip

 


Step 4
At this point you should have the following 3 files, the names will be slightly different for future release versions.

Now create a project directory, for the purpose of this article, I am going to create a folder called, "sqlite3" under, "G:/dev/src/". You can choose another location where the source code will be get extracted.

 

  • extract the ICU zip file to, "G:/dev/src/"

     

  • extract both SQLite3 zip files to "G:/dev/src/sqlite3"

     

  • create folder "G:/dev/src/build"

At this point your project folder hierarchy should be similar to:

We have one final clean up to do, and that is to delete "sqlite3.dll" from the location, "G:/dev/src/sqlite3/"

Note let's take a look at the Environment variables section...

 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值