1. Actually, you aren't using the C++ api, you are using the C api.
That's probably why you are having linking warnings.
I think you should probably be linking to libmySQL.dll
(or libmysqlclient.a if you compiled the library yourself).
//*****************************
You're host is wrong.
'host' may be an IP address, NULL, or "localhost", but not the name of an executable program.
//*****************************
2. Warnings will not cause a link to fail.
3. You aren't checking the return values of mysql_init or mysql_real_connect for errors.
You are getting an error and instead of aborting you are querying the database with a
bad conn pointer. (I think it has been set to 5, which is definately a bad pointer.)
conn = mysql_init(NULL); /* allocate, initialize connection handler */
if (conn == NULL) {
... error ...
return (NULL);
}
void *a = mysql_real_connect (conn, host_name, user_name, password,
db_name, port_num, socket_name, flags);
if ( a == NULL ) {
... error ...
return (NULL);
}
4. No symbolic information means those dlls were not compiled with the debug option,
so you can't see any debugging information from those dlls.
5. You should probably download the C API instead.
This is an example of using the C++ API:
http://www.mysql.com/documentation/m..._Tutorial.html
Don't worry, you can still use the C API from a C++ program. I do all the time,
except instead of using Visual C++ I use gcc. I wouldn't recommend using gcc,
however, because if you do you also have to recompile the libmysqlclient library
with gcc. MySQL has already compiled it using Visual C++ so it makes sense to use
Visual C++ whenever you can.