Windows的SQLite静态库

debug和release版

Num(Current Version): 3470000

Debug版

“Source Code” -> sqlite-amalgamation-Num.zip

新建DLL工程

project name: sqlite3(使用这个名字主要是在生成lib的时候不用更改输出名了)

VS2022 prj1

添加SQLite源文件

拷贝以下文件到工程根目录:

  • sqlite3.h
  • sqlite3ext.h
  • sqlite3.c

VS2022 prj2

VS2022 prj21

编译工程

Project ==> Properties ==> General

Configureation Type : Static library(.lib)

编译即可

Build -> Rebuild sqlite3

预编译头文件

Project ==> Properties ==> C/C++ ==> Precompiled Header

Not Using Precompiled Headers
  • vs2019
sqlite3.c : fatal error C1853: 'Debug\sqlite3.pch' precompiled header file is from a previous version of the compiler,
or the precompiled header is C++ and you are using it from C (or vice versa)
  • vs2022
sqlite3.c : error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "pch.h"' to your source?

XP support

vs2013 Project ==> Properties ==> General

Platform Toolset -> Visual Studio 2013 - Windows XP(v120_xp)

Release版

Precompiled Binaries for Windows, 下载

sqlite-dll-win32-x86-Num.zip

output lib file

Start menu -> Visual Studio 2022 -> x86 Native Tools Command Prompt for VS 2022
Enter the following command:

cd C:\Users\tdtc\Documents\sqlite-dll-win32-x86-Num
lib /def:sqlite3.def /out:sqlite3.lib /machine:x86

Ref