|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
Last 3 errors that need to be corrected..
I have changed the problem according to this url:
http://www.cpp-home.com/tutorial.php?22_1 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. error is: ompiler: Default compiler Executing g++.exe... 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 p\include\mysql\mysql\lib" -L"C:\DEV-CPP\lib" In file included from C:/Dev-Cpp/include/mysql/mysql/include/mysql.h:71, from C:/Dev-Cpp/test2.cpp:4: c:/Dev-Cpp/include/mysql/mysql/include/mysql_com.h:115: syntax error before `;' token Execution terminated test2.cpp file://#include <c:\Dev-Cpp\include\stdio.h> #include <stdio.h> file://#include <c:\Dev-Cpp\include\mysql\mysql\include\mysql.h> #include <mysql.h> #define host "192.168.1.99" #define username "myname" #define password "mypassword" #define database "buynsell" MYSQL *conn; int main() { conn = mysql_init(NULL); mysql_real_connect(conn,host,username,password,database,13306,NULL,0); MYSQL_RES *res_set; MYSQL_ROW row; 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"); } } mysql_close(conn); return 0 ; please also examin a second in the next thread above this. |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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". http://www.cpp-home.com/tutorial.php?22_1 |
|
#4
|
|||
|
|||
|
Simular problems
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: Connection con(use_exceptions); con.connect("MyDatabase"); ...and here are my results: In file included from D:/Dev-Cpp/include/mysql.h:79, from main.cpp:7: 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. |
|
#5
|
||||
|
||||
|
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
![]() |
|
#6
|
|||
|
|||
|
Could you attach mysql.h so I could look at it?
|
|
#7
|
|||
|
|||
|
MySql.h attachment
MySql.h has several files it includes as well, so I included the entire MySql include directory for reference.
Thanks for any help! |
|
#8
|
|||
|
|||
|
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...
|
|
#9
|
|||
|
|||
|
I usually include:
#include <windows.h> #include <stdio.h> #include <string.h> #include <iostream> 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. Thanks anyway! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Last 3 errors that need to be corrected.. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|