Sign in to follow this  

Sqlite + Linking Problem

This topic is 4099 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working with Sqlite and I just decided to test the program on their site, the program has no error, I added additional preprocessor files and I have also added the mysqlite3.dll file to the project too. The code compiles error free but at the time of link it shows this:
Linking...
main.obj : error LNK2001: unresolved external symbol _sqlite3_free
main.obj : error LNK2001: unresolved external symbol _sqlite3_exec
main.obj : error LNK2001: unresolved external symbol _sqlite3_close
main.obj : error LNK2001: unresolved external symbol _sqlite3_errmsg
main.obj : error LNK2001: unresolved external symbol _sqlite3_open
Can anyone tell me whats going wrong with this???

Share this post


Link to post
Share on other sites
I had a problem like this before. It looks like you need to find your linker seting for prefixing library names with an underscore. Try turning it on or off to see what happens. Which compiler are you using?

Share this post


Link to post
Share on other sites
My problem was with Borland C++ compiling from the Cg library. I think in Visual Studio there are build settings for your project which is a dialog with things to choose from like Linking/Debugging and the like. I would look through your project's settings and try to find one about libraries and underscores. MSDN might be able to help you find it.

Share this post


Link to post
Share on other sites
I don't think you are linking to the sqlite3.lib file.

project->settings->link - add sqlite3.lib to the object/library modules for both debug and release modes.

If you don't have a sqlite3.lib file you may need to build it.

You can download windows binaries for sqlite from the sqlite.org downloads page. There is a sqlite3.def file in there that you will need to use to build your library file (why they don't just supply the library file I don't know).

Open a command prompt, get to the directory of your sqlite3.def file and you will need to do the following:

Set up the paths etc. to your build tools:

C:\whatever directory has sqlite3.def\> vcvars32.bat

Then you can build the .lib file by using

C:\whatever\> LIB /DEF:sqlite3.def

You can keep this file with the project or you can add a sqlite3 directory to VS in the tools->options page.

There is another post on this here but the VCVARS32.BAT file should take care of making sure that lib.exe is available to you.

Share this post


Link to post
Share on other sites

This topic is 4099 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this