[sqlite] C++ Unresolved external errors from DLL

512 views
Skip to first unread message

Michael Pateras

unread,
Oct 9, 2010, 2:23:38 AM10/9/10
to sqlite...@sqlite.org
I'm trying to get SQLite working in my C++ project via a DLL, but I"m
getting unresolved external symbol errors.

I downloaded SQLiteDLL-3 from the download page, extracted its contents (a
DLL and a .h file), and ran lib.exe on it to produce a .lib file. I then set
the directory containing the .lib and the .dll files to be an Additional
Library Directory, in the project settings, under Linker >> General. Then I
downloaded SQLiteSource-3 from the download page, and extracted the
SQLite3.h file to the directory with the .Lib and .DLL files, and added that
directory as an Additional Include Directory under C/C++ >> General. I added
#include to my main file, and then added sqlite3.lib as an Additional
Dependency in Linker >> Input.

When I try to compile, I get these errors:

error LNK2019: unresolved external symbol _sqlite3_exec referenced in
function _main

error LNK2019: unresolved external symbol _sqlite3_open referenced in
function _main

fatal error LNK1120: 2 unresolved externals

Can somebody point me in the right direction to figuring out why this is
happening, and what I can do to resolve it?

Thank you.
_______________________________________________
sqlite-users mailing list
sqlite...@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Doug

unread,
Oct 11, 2010, 10:29:22 AM10/11/10
to General Discussion of SQLite Database
What command line are you using with lib?

I usually run the following:
link /lib /def:sqlite3.def

and create a .def file with all the functions that I want to call.

An example of the .def file contents:
EXPORTS
sqlite3_aggregate_context
sqlite3_aggregate_count
sqlite3_auto_extension
sqlite3_bind_blob
sqlite3_bind_double
sqlite3_bind_int
sqlite3_bind_int64
sqlite3_bind_null
sqlite3_bind_parameter_count
sqlite3_exec
sqlite3_open
...

That's always worked for me.

Doug

Reply all
Reply to author
Forward
0 new messages