by Yeoh HS dated September 2005, version 0.03

Introduction
This step-by-step guide shows you how to use Dev-C++ 4.9.9.2 (GCC Version 3.4.2) to compile both SQLite versions 2.8.16 and 3.2.2 as static libraries. It also includes two test programs that show you how to use the static libraries.
Using SQLite Version 2.8.16
Step 1: Download the source codes.
Of the several packages, the one to download is this. http://www.sqlite.org/sqlite-source-2_8_16.zip
Step 2:Compiling SQLite 2.8.16 as a Static Library
2.1 In Dev-C++ IDE select New Project, Static Library, C Project, then type name of project, for example, libsqlite2816.
2.2 Add all source files, then remove shell.c and tclsqlite.c. These two files are not required.
2.3 In Dev-C++ IDE select Project Options, Parameters, Compiler, set define, -D _NO_OLDNAMES
2.4 In Dev-C++ IDE select Rebuild All
The static optimized library should build with no errors or warnings.
Step 3: Building a C++ Application to Test LibSQLite2816
3.1 In Dev-C++ IDE select New Project, Console Application, C++ Project, then type project's name, for example, test.
3.2 Modify default main.cpp and save it. (For details to be modified in main.cpp, see zip file project at the end of this page.)
3.3 Copy sqlite.h and libsqlite2816.a into the project's folder.
3.4 In Dev-C++ IDE select Project Options, Directories, Include Directories, Add . (a dot which means current directory)
3.5 In Dev-C++ IDE select Project Options, Parameters, Linker, Add libsqlite2816.a
3.6 In Dev-C++ IDE select Rebuild All
The test program should build with no errors or warnings. Note: The test program in the zip file uses a sample SQLite 2 database, sqlitepp.db.
Compiling SQLite Version 3.2.2 as a Static Library
Step 1: Download the source codes.
Of the several packages, the one to download is this. http://www.sqlite.org/sqlite-source-3_2_2.zip
Step 2: Compiling SQLite 3.2.2 as a Static Library
2.1 In Dev-C++ IDE select New Project, Static Library, C Project, type name, for example, libsqlite322
2.2 In Dev-C++ IDE, add all source files, then remove shell.c and tclsqlite.c.
2.3 In Dev-C++ IDE select Rebuild All
The static optimized library should build with no errors or warnings.
Step 3: Building a C++ Application to Test LibSQLite322
3.1 In Dev-C++ IDE, select New Project, Console Application, C++ Project, type project's name, for example, test.
3.2 Modify default main.cpp and save it. (For details to be modified in main.cpp, see zip file for project at the end of this page.)
3.3 Copy sqlite3.h and libsqlite322.a into the project's folder.
3.4 In Dev-C++ IDE select Project Options, Directories, Include Directories, Add . (a dot which means current directory)
3.5 In Dev-C++ IDE select Project Options, Parameters, Linker, Add libsqlite322.a
3.6 In Dev-C++ IDE select Rebuild All
The test program should build with no errors or warnings. Note: The test program in the zip file uses a sample SQLite 3 database, test.db.
Important Notes
SQLite 2.8.16 and SQLite 3.2.2 are two different versions of SQLite. The databases are not compatible and the API are also different.
Download
DevCppSQLite.zip (2.68 MB) which contains all the projects below.
Special Note: If you are using Visual C++ and would like to know how to use SQLite with Visual C++, you can find more information about it here.

This page was last updated on 2 September 2005
Copyright © 2005 by Yeoh HS, All Rights Reserved
Search Engine Optimization and Free Submission