mariaDB_client-1-0-0_win64 in Visual Studio 2012
Hello,
I have installed MariaDB 5.6 , and its works perfectly. Thanks to all the MariaDB team.
I also installed (by *.msi) mariaDB_client-1-0-0_win64 in c:\L\SQLClient\mariadb_client-1.0.0-win64\
+ added paths as follow in project properties of the Visual Studio 2012 sheet:
INCLUDE DIRECTORIES = C:\L\SQLClient\mariadb_client-1.0.0-win64\mariadbclient\include;$(IncludePath) LIBRARY DIRECTORIES = C:\L\SQLClient\mariadb_client-1.0.0-win64\lib;$(LibraryPath)
Compilation is OK, However, linking fails:
--- my minimal c++ program (c++ console under Visual Studio 2012 ---
#include "stdafx.h" #include <mysql.h> int _tmain(int argc, _TCHAR* argv[]) { // Declare the pointer to control structure MYSQL. // No errors, so declarations include *.h files worked for Visual Studio intellisense MYSQL *my; // Just initialize the structure - // No errors in edit mode, but enough to create a link error my = mysql_init(NULL); }
BUILDING PROJETS -> following error msg:
1>------ Build started: Project: cppconMariaDB02, Configuration: Debug Win32 ------ 1>cppconMariaDB02.obj : error LNK2019: unresolved external symbol _mysql_init@4 referenced in function _wmain 1>c:\users\olivier\documents\visual studio 2012\Projects\cppconMariaDB02\Debug\cppconMariaDB02.exe : fatal error LNK1120: 1 unresolved externals ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Every mysql function gets the same "unresolved external symbol" error, even though I believe I did specify the path to the directory containing the 3 files "libmariadb.dll, libmariadb.lib & mariadbclient.lib", which I even tried (for testing purposes only, and with no better results) to copy into windows/system32.
I have spent a lot of time on this issue, with no success. I did see that this question was asked several times on several programming sites, but it never gets any answer.
As additional info, here is my directory for the c mariadb_client client:
Directory of c:\L\SQLClient\mariadb_client-1.0.0-win64 <DIR> .. docs examples html lib libmysql mariadbclient mysql_config unittest zlib
I hope that the above information (and question) is clear and complete, but not over verbose, and that someone in your team will have a few seconds to answer my query, even though the answer may be trivial (at least for him). And once again, many thanks for a very nice product.
Sincerely yours Olivier, Paris, France
PS And hello to Michael 'Monty' Widenus, whom I met in Paris six months ago.
Answer Answered by Sergei Golubchik in this comment.
I suppose, you need to specify the library you want to link with, just setting a library path is not enough. See http://en.wikibooks.org/wiki/C%2B%2B_Programming/Compiler/Linker/Libraries/Configuring_Visual_Studio