How to Build SQLite3 .lib File on Windows 10


While SQLite provides pre-built binary files for various platforms, there might be situations where you need to build a custom .lib file on Windows 10. In this tutorial, we'll guide you through the process of building the SQLite3 .lib file step by step.

This post is originally published on gist.

Download the Source Code

Begin by downloading the SQLite source code from the official website. Visit and choose the "Amalgamation" source code archive.

For example, you can download the source from this link:

Download the Binary Files

Next, you'll need the binary files. Head back to the SQLite download page, and this time, select the appropriate binary package for your system.

For Windows 64-bit, you can download the binary from this link:

Extract Both Archives

After downloading both the source code and binary files, navigate to the folder where you've saved them and extract the contents of both archives to the same directory. For example: C:\sqlite

Open Developer Command Prompt for Visual Studio 2017

To build the .lib file, you'll need to use the Developer Command Prompt for Visual Studio 2017 or a later version. You can easily access it by typing Developer Command in the Windows search bar and selecting the appropriate option.

Build the .lib File

In the Developer Command Prompt, use the cd command to navigate to the directory where you've extracted the SQLite source code and binary files. For example:

cd C:\sqlite

Make sure to replace C:\sqlite with the actual path to your directory.

Now that you're in the correct directory, you can build the .lib file using the lib command. Enter the following command:

lib /DEF:sqlite3.def /OUT:sqlite3.lib /MACHINE:x64

This command tells the Microsoft Library Manager (lib) to create a .lib file (sqlite3.lib) from the definition file (sqlite3.def) for the x64 architecture.

We are Done!

You have successfully built the SQLite3 .lib file on Windows 10.