简体   繁体   中英

C++ Linking SQLite to Visual Studio 2019 project

I am trying to use SQLite with Visual Studio 2019. I downloaded "amalgamation" package and included"sqlite3.h" and "sqlite3.c" files to the project but I get errors(link to pastebin below)

#include "sqlite3.h"
#include "sqlite3.c"

https://pastebin.com/6T5HMnyh

What am I doing wrong?

I had hit this same thing today. As SM stated, you don't want to include the.c file anywhere in this process. You should include the sqlite3.h file and follow these instructions. I found that I not only had to download the amalgmation files but also the dll files (for either x64 or x86 depending on your flavor). I used https://sqlite.org/2021/sqlite-dll-win32-x86-3360000.zip , which gave me a.dll and a.def file. Copy them to your project directory and then open up a Visual Studio command prompt (terminal in the View menu). Browse to the directory that you've copied the files to and type LIB /DEF:sqlite3.def . This will create a library file for VS to use. Add this file to your project dependencies at Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies (you'll have to type it in manually as you can't browse). Compiling in Visual Studio should now work successfully.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM