Hello everyone,
I'm pretty new with Visual c++6 but I'm trying to connect to MySQL server with no success.
When I compile my code, I get this error "fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
Error executing cl.exe."
I did put the file libmySQL.lib in the VC++ lib folder. I have also set the path through tools->options->Directories and then entered the VC++lib folder path. I also went to Project->settings ->links and I entered libmySQL.lib to the Object/Library modules text box.
I'm not sure if libmySQL.lib is the right file to use. I saw some posting where they talk about mysql++.lib as the file to use but I just can't find it anywhere.
Can somedoby help me on this problem??
this is the code that compile and where I get the error message.
#include<stdio.h>
#include<mysql.h>
using namespace std;
#define host "localhost"
#define username "username"
#define password "password"
#define databse "Mydatabse"
MYSQL *conn;
int main()
{
conn = mysql_init(NULL);
mysql_real_connectconn,host,username,password,data bse,0,NULL,0);
MYSQL_RES *res_set;
MYSQL_ROW row;
unsigned int i;
mysql_query(conn,"SELECT * FROM users WHERE userid=1);
res_set = mysql_store_result(conn);
unsigned int numrows = mysql_num_rows(res_set);
while((row=mysql_fetch_row(res_set))!=NULL)
{
for(i=0; i<mysql_num_fields(res_set); i++)
{
printf("%s\n",row[i] != NULL ? row[i] : "NULL");
}
}
mysql_close(conn);
return 0;
}
}