Do Good! - Share Freely, Enrich and Empower people to Transform their lives.
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:
(*) 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.
- download and install VC++ Express (free)
- download and install Microsoft Platform SDK (PSDK) (the Windows Server 2003 is ok for windows XP)
- setup the options in VC++ Express so that it knows in which directory the PSDK stored the .lib files
- follow your tutorial, plus adding the advapi32.lib in order to be able to build iuc*
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!
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.
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
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/home.php
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
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.
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\"
Next let's take a look at the Environment variables section...
- 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"
Copyright © 2007 Rajinder Yadav, All rights reserved