Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error linking sqlite with C++ using vscode in windows

I'm doing a job that needs linking Sqlite with C++, but I've encountered some troubles doing this.

I've searched many courses already. I've added all the files more than needed sqlite3.dll,sqlite3.def,sqlite3.h.sqlite3.exe,sqlite3.lib

into the project folder but I still failed to do it right.

enter image description here

enter image description here

the result of compiling main.cpp

enter image description here

include "sqlite3.h"

like image 822
Ke Chen Avatar asked Sep 12 '26 06:09

Ke Chen


1 Answers

You just have to 1) add the .h header file to your include path 2) add the .lib library file to your libraries path 3) add a static link to the .lib file in your project properties (both debug and release builds) 4) remove all other references (def, dll, exe) from the project 5) make sure the .dll file is in the same directory as your .exe

like image 168
Manos Anastasiadis Avatar answered Sep 15 '26 07:09

Manos Anastasiadis



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!