vcherubini
Programmer
Hello, I am working on integrating C/C++ with the C/C++ mysql api to make an application.
However, I can not, for the life of me, get this code to compile in VC++.
I have installed the mysql++.lib file that you compile when you download the C/C++ API from along with putting the correct header files in the Include directory.
Here is the code, I got it from the book MySQL by Paul DuBois:
[tt]
/* client1.c */
#include <stdio.h>
#include <mysql.h>
#define def_host_name localhost /* host to connect to (default = localhost) */
#define def_user_name username /* user name (default = your login name) */
#define def_password password /* password (default = none) */
#define def_db_name database /* database to use (default = none) */
MYSQL *conn; /* pointer to connection handler */
int
main (int argc, char *argv[])
{
conn = mysql_init (NULL);
mysql_real_connect (
conn, /* pointer to connection handler */
def_host_name, /* host to connect to */
def_user_name, /* user name */
def_password, /* password */
def_db_name, /* database to use */
0, /* port (use default) */
NULL, /* socket (use default) */
0); /* flags (none) */
mysql_close (conn);
exit (0);
}
[/tt]
Here are the errors I am getting:
[tt]
client1.obj : error LNK2001: unresolved external symbol _mysql_close@4
client1.obj : error LNK2001: unresolved external symbol _mysql_real_connect@32
client1.obj : error LNK2001: unresolved external symbol _mysql_init@4
[/tt]
Any help is appreciated.
Thanks,
-Vic vic cherubini
krs-one@cnunited.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash
====
However, I can not, for the life of me, get this code to compile in VC++.
I have installed the mysql++.lib file that you compile when you download the C/C++ API from along with putting the correct header files in the Include directory.
Here is the code, I got it from the book MySQL by Paul DuBois:
[tt]
/* client1.c */
#include <stdio.h>
#include <mysql.h>
#define def_host_name localhost /* host to connect to (default = localhost) */
#define def_user_name username /* user name (default = your login name) */
#define def_password password /* password (default = none) */
#define def_db_name database /* database to use (default = none) */
MYSQL *conn; /* pointer to connection handler */
int
main (int argc, char *argv[])
{
conn = mysql_init (NULL);
mysql_real_connect (
conn, /* pointer to connection handler */
def_host_name, /* host to connect to */
def_user_name, /* user name */
def_password, /* password */
def_db_name, /* database to use */
0, /* port (use default) */
NULL, /* socket (use default) */
0); /* flags (none) */
mysql_close (conn);
exit (0);
}
[/tt]
Here are the errors I am getting:
[tt]
client1.obj : error LNK2001: unresolved external symbol _mysql_close@4
client1.obj : error LNK2001: unresolved external symbol _mysql_real_connect@32
client1.obj : error LNK2001: unresolved external symbol _mysql_init@4
[/tt]
Any help is appreciated.
Thanks,
-Vic vic cherubini
krs-one@cnunited.com
====
Knows: Perl, HTML, JavScript, C/C++, PHP, Flash
====