January 25th, 2003, 05:17 PM
Last 3 errors that need to be corrected..
I have changed the problem according to this url:
I am following this url to retype everything. I have take the long-path
with these *.h. My error is now left to 3. I have attached these files in
*gif ( with <----- pointing to its line #) for your inspection.
Hope u can help to start the "First C++ with mysql". I have not able to find
C++ or visual C++ with mysql.
ompiler: Default compiler
g++.exe "C:\Dev-Cpp\test2.cpp" -o
C:\Dev-Cpp\test2.exe" -O3 -pg -g3 -I"C:\DEV-CPP\include" -I"C:\Dev-Cpp\i
nclude\c++\backward" -I"C:\Dev-Cpp\include\mysql" -I"C:\DEV-CPP\include"
-I"C:\DEV-CPP\include\c++" -I"C:\Dev-Cpp\include\mysql" -I"C:\Dev-Cpp\incl
ude\mysql\mysql\include" -I"C:\Dev-Cpp\include\mysql\include" -I"C:\Dev-Cp
In file included from C:/Dev-Cpp/include/mysql/mysql/include/mysql.h:71,
c:/Dev-Cpp/include/mysql/mysql/include/mysql_com.h:115: syntax error before
#define host "192.168.1.99"
#define username "myname"
#define password "mypassword"
#define database "buynsell"
conn = mysql_init(NULL);
unsigned int i;
mysql_query(conn,"SELECT * FROM buynsell where ID > 10000 ");
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");
return 0 ;
please also examin a second in the next thread above this.
January 25th, 2003, 08:16 PM
The first error ("In file included from C:/.../mysql.h") tells you that the file included in line 71 of mysql.h has an error in it. This is the file mysql_com.h.
So, look at the error for mysql_com.h. The compiler complains about line 115, and it appears to be a simple syntax error. Check that line for problems, make sure any class/struct/etc you use in that line has been properly defined.
As for the third error, it's rather amibiguous. Clean up the other error and it may go away. If not, hopefully it will give you some more info.
January 26th, 2003, 07:41 AM
because those two files mysql_com.h and mysql.h are the original.
I do not see a reason they are trouble me a lot and I can solve these errors myself.
The original author just return a "failure email".
January 30th, 2003, 12:13 AM
I am having the same problems, and it appears to be the problem with the includes that were shipped with the MySql release.
I have tried including MySql.h in a sample project in Dev-C++ and then tried to connect to the database by simply using the following:
...and here are my results:
In file included from D:/Dev-Cpp/include/mysql.h:79,
D:/Dev-Cpp/include/mysql_com.h:215: parse error before string constant
D:/Dev-Cpp/include/mysql_com.h:216: parse error before string constant
D:/Dev-Cpp/include/mysql_com.h:218: parse error before string constant
D:/Dev-Cpp/include/mysql_com.h:223: parse error before string constant
In file included from main.cpp:7:
D:/Dev-Cpp/include/mysql.h:134: parse error before string constant
D:/Dev-Cpp/include/mysql.h:155: parse error before string constant
D:/Dev-Cpp/include/mysql.h:221: parse error before string constant
D:/Dev-Cpp/include/mysql.h:226: parse error before string constant
Both mysql.h and mysql_com.h are taken from the MySql include directories, along with the other headers also needed.
I am very new, yet this seems to be a problem within the includes that should work fine since they are taken from the installed files of MySql itself.
January 30th, 2003, 12:13 PM
Do me a favour, can you please change all the \ to \\ in the path names and see what happens. IIRC, this always used to give me problems when I coded things in Turbo-C for DOS :)
January 30th, 2003, 12:14 PM
Could you attach mysql.h so I could look at it?
January 30th, 2003, 02:29 PM
MySql.h has several files it includes as well, so I included the entire MySql include directory for reference.
Thanks for any help!
January 31st, 2003, 03:21 PM
I don't know. I found a riddle of errors myself in those header files, but I never had much time to hunt them down and read the directions. I suspect that there needs to be another file included prior to mysql.h, because as it stands, if I simply include mysql.h, I get a bunch of storage-class specifier errors. Sorry, but I don't currently have the time to work through all this...
January 31st, 2003, 03:31 PM
I usually include:
Along with MySql.h of course, but then there are still errors...
I am going to try and just use some of the newer classes in wxWindows. There are revamps to all the database classes, and hopefully they will work.