Problems with SOCI

432 views Asked by At

I'm trying to use the SOCI library for easy MySQL access but I'm stuck at installing the library.

What I've done so far is :

  • Made the project and compiled it with CMake
  • Linked my project to the lib/release directoy that's created after compilation.
  • Linked my project to the MySQL C Connector lib directory

and here are my additional include directories : http://puu.sh/6qGNP.png

But somehow, when I compile the example program, I get a bunch of linker errors like these :

1>main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall soci::details::standard_into_type::~standard_into_type(void)" (??1standard_into_type@details@soci@@UAE@XZ) referenced in function "public: virtual __thiscall soci::details::into_type::~into_type(void)" (??1?$into_type@H@details@soci@@UAE@XZ) 1>main.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall soci::details::standard_into_type::post_fetch(bool,bool)" (?post_fetch@standard_into_type@details@soci@@MAEX_N0@Z)

Where did I mess up?

1

There are 1 answers

0
Guy Thouret On BEST ANSWER

From the documentation:

Required Client Libraries

The SOCI MySQL backend requires MySQL's libmysqlclient client library.

Note that the SOCI library itself depends also on libdl, so the minimum set of libraries needed to compile a basic client program is:

-lsoci_core -lsoci_mysql -ldl -lmysqlclient

This has always worked for me. If you want to link them from the build location a -L switch with the path to the libraries will need to be passed to the compiler.