# How to Build SQLite3 .lib File on Windows 10

> A short guide on how to build SQLite3 .lib file for Windows 10.

- URL: https://zeljic.com/blog/sqlite-lib-windows-10/
- Author: Đorđe Zeljić
- Published: 2018-10-30
- Updated: 2023-09-24
- Tags: sqlite, windows, lib

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](https://gist.github.com/zeljic/d8b542788b225b1bcb5fce169ee28c55).

## Download the Source Code

Begin by downloading the SQLite source code from the official website.
Visit https://www.sqlite.org/download.html and choose the "Amalgamation" source code archive.

For example, you can download the source from this link: [sqlite-amalgamation-3430100.zip](https://www.sqlite.org/2023/sqlite-amalgamation-3430100.zip)

## 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: [sqlite-dll-win64-x64-3430100.zip](https://www.sqlite.org/2023/sqlite-dll-win64-x64-3430100.zip).

## 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:

```powershell
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:

```powershell
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.
