SunQuest
           C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old January 25th, 2003, 05:17 PM
tiny12 tiny12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 135 tiny12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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.
Attached Images
File Type: gif test2-2cpp.gif (18.7 KB, 303 views)

Reply With Quote
  #2  
Old January 25th, 2003, 08:16 PM
MJEggertson MJEggertson is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2002
Location: Seattle WA
Posts: 863 MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 sec
Reputation Power: 8
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.

Reply With Quote
  #3  
Old January 26th, 2003, 07:41 AM
tiny12 tiny12 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Posts: 135 tiny12 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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

Reply With Quote
  #4  
Old January 30th, 2003, 12:13 AM
Influxion Influxion is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 4 Influxion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #5  
Old January 30th, 2003, 12:13 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 5th Plane (7000 - 7499 posts)
 
Join Date: Nov 2001
Location: Glendale, Los Angeles County, California, USA
Posts: 7,442 Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level)Scorpions4ever User rank is Major General (70000 - 90000 Reputation Level) 
Time spent in forums: 1 Month 2 h 5 m 45 sec
Reputation Power: 797
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

Reply With Quote
  #6  
Old January 30th, 2003, 12:14 PM
MJEggertson MJEggertson is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2002
Location: Seattle WA
Posts: 863 MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 sec
Reputation Power: 8
Could you attach mysql.h so I could look at it?

Reply With Quote
  #7  
Old January 30th, 2003, 02:29 PM
Influxion Influxion is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 4 Influxion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!
Attached Files
File Type: zip mysql.zip (46.3 KB, 305 views)

Reply With Quote
  #8  
Old January 31st, 2003, 03:21 PM
MJEggertson MJEggertson is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2002
Location: Seattle WA
Posts: 863 MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level)MJEggertson User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 sec
Reputation Power: 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...

Reply With Quote
  #9  
Old January 31st, 2003, 03:31 PM
Influxion Influxion is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 4 Influxion User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Last 3 errors that need to be corrected..


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway