September 2nd, 2003, 07:13 PM
VC++6 and MySQL++
This was posted in the MySQL forum but I was told it might be better off here. So here's the post again.
I have seen this code posted before on here and other websites.
#define host "localhost"
#define username "db_username"
#define password "db_password"
#define database "db"
conn = mysql_init(NULL);
unsigned int i;
mysql_query(conn,"SELECT * FROM users WHERE
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");
When I try to compile it I get this error.
fatal error C1083: Cannot open include file: 'mysql.h': No such file or directory
I have placed the library into my Visual C++ Lib directory as well as copied all of the include files into my VC++ Includes directory and specified to link in MySQL++.lib
The error is pointing into the file defs.h where it is trying to include <mysql.h>.
Obviously it's not locating that include file but I'm not sure if I can just find the file and include it somewhere or if I missing something else here.
September 3rd, 2003, 09:33 AM
if you wanna include any file(you might already know this) you can dump it in the project directory where you have the other source files and do
Notice the double quotes instead of <...>
I don't know if the Mysql stuff includes DLL's, but if they do, don't forget to add them to your environment path. I think it's in options>settings>c/c++ tab , not 100% sure though.