Skip to content

Instantly share code, notes, and snippets.

@zeljic
Last active January 16, 2026 19:25
Show Gist options
  • Select an option

  • Save zeljic/d8b542788b225b1bcb5fce169ee28c55 to your computer and use it in GitHub Desktop.

Select an option

Save zeljic/d8b542788b225b1bcb5fce169ee28c55 to your computer and use it in GitHub Desktop.
Build SQLite3 .lib file on windows

How to build SQLite3 .lib file on Windows 10

  1. Download source from source

    For example: source https://www.sqlite.org/2023/sqlite-amalgamation-3430100.zip

  2. Download binary from binary

    For example: binary https://www.sqlite.org/2023/sqlite-dll-win64-x64-3430100.zip

  3. Extract both archives to the same directory

  4. Open Developer Command Prompt for VS 2017 by typing Developer Command in Windows Search

  5. Go to directory where you've extracted source code and binary files (via opened cmd)

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

Blog post

@sito8943

Copy link
Copy Markdown

Ty a lot

@OhmPopy

OhmPopy commented Feb 25, 2022

Copy link
Copy Markdown

thank

@H3d9

H3d9 commented May 9, 2022

Copy link
Copy Markdown

great

@lzw875

lzw875 commented Oct 13, 2022

Copy link
Copy Markdown

Thank you!

@lakeweb

lakeweb commented Oct 27, 2022

Copy link
Copy Markdown

Thanks! And this works on windows 11 VS2022.

@zeljic

zeljic commented Oct 27, 2022

Copy link
Copy Markdown
Author

Thanks! And this works on windows 11 VS2022.

Great!

@GlitchyCrafting

Copy link
Copy Markdown

this was a life saver

@vincefav

Copy link
Copy Markdown

Thank you!

@PierreBonnefoy

Copy link
Copy Markdown

Thank you ! You're my god now.

@TheUniKian

TheUniKian commented Jun 9, 2023

Copy link
Copy Markdown

I'm having an issue where, after following the final command, LINK : fatal error LNK1104: cannot open file 'sqlite3.def'

This is how the directory looks if it matters

This is how the command prompt looks

@zeljic

zeljic commented Jun 9, 2023

Copy link
Copy Markdown
Author

@TheUniKian You have to be inside sqlite directory.
So, you first have to do cd C:\Users\_USER_\Downloads\sqlite

@TheUniKian

Copy link
Copy Markdown

It never worked in CMD so I never thought to try it there. I'm so sorry

@heavenle

Copy link
Copy Markdown

nice, thank you!

@JohnnyTNguyen

Copy link
Copy Markdown

Thank you!

@zeljic

zeljic commented Sep 18, 2023

Copy link
Copy Markdown
Author

Updated to latest source and binary (version 3.43.1.)

@JulyIghor

Copy link
Copy Markdown
SQLITE_VERSION=$(echo $(curl -s 'https://www.sqlite.org/download.html') | awk '{ sub(".*sqlite-autoconf-",""); sub("\\.tar.*",""); sub("/.*",""); print; }')

DLL_URL="https://www.sqlite.org/`date +"%Y"`/sqlite-dll-win64-x64-${SQLITE_VERSION}.zip"
SOURCE_URL="https://www.sqlite.org/`date +"%Y"`/sqlite-amalgamation-${SQLITE_VERSION}.zip"

@Leow12487

Copy link
Copy Markdown

Hi Everyone, I have a issue about the final command , it says ### fatal error LNK1104: cannot open file 'sqlite3.def'
Here is the picture

Fatal Error 2023 - 12 - 19

@zeljic

zeljic commented Dec 19, 2023

Copy link
Copy Markdown
Author

You are in wrong directory, you are executing lib command in C:\Program Files\Microsoft Visual Studio\2022\Community but you should first move to D:\sqlite-amalgamation-3430100

@Leow12487

Copy link
Copy Markdown

Issue solved ,thank you @zeljic

@hunter2009pf

Copy link
Copy Markdown

thank you, sir~

@KerwinChina

Copy link
Copy Markdown

thank you

@thefox61

Copy link
Copy Markdown

thank you!

@liukuo362573

Copy link
Copy Markdown

thank you!

@danhiu

danhiu commented Aug 15, 2024

Copy link
Copy Markdown

You are so handsome!

@prajjwalsingh11

Copy link
Copy Markdown

thanks saviour

@Amitminer

Copy link
Copy Markdown

thankyou sir!

@BuckSevereSky

Copy link
Copy Markdown

Thank you, concise and clear and works perfectly.

@AustinBrown12

Copy link
Copy Markdown

Hello
When I download sqlite-amalgamation-3430100, there are several files.
sqlite
How to build static sqlite3.lib file on windows?

@AustinBrown12

Copy link
Copy Markdown

Give me an advise.
If someone know that, let me know.

@0riginaln0

Copy link
Copy Markdown

@AustinBrown12
read more carefully 2-6 points.

Your folder will look like this
image
then open the "Developer Command Prompt For VS..." cd into the folder with the files and run lib /DEF:sqlite3.def /OUT:sqlite3.lib /MACHINE:x64

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment