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: 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)
However, when trying to use it even with the most simple programs, compilation is OK, BUT linking fails:
Sorry for the wrong layout, But I cannot stop the wrong formatiing. I hope you will still be able to read this minimalist program.
--- 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 include 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); } -- end of program --
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 -> List of sub-directories
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
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