• Popular Now

• 14
• 12
• 9
• 10
• 9

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

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 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 on other sites
I am using Visual C++ 6... How can I do that ?

Moreover, I tried to compile the simplest program of mysql and it failed horribly too.

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 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.