当前位置: 技术问答>linux和unix
编译出错,帮我看看代码和出错信息
来源: 互联网 发布时间:2015-06-13
本文导语: 1 #include 2 #include 3 #include 4 5 6 main ( ) 7 { 8 MYSQL mysql; 9 MYSQL_RES *result; 10 MYSQL_ROW row; ...
1 #include
2 #include
3 #include
4
5
6 main ( )
7 {
8 MYSQL mysql;
9 MYSQL_RES *result;
10 MYSQL_ROW row;
11 char mysql_query[60]="select `TeamSn` form `team` where 1 and TeamName=";
12 char *team_name="'CHARLEROI'";
13
14
15 strcat(mysql_query,team_name);
16 printf("%s",mysql_query);
17 mysql_init(&mysql);
18 if (mysql_real_connect(&mysql,"192.168.3.111","root","654321","surebet",0,NULL,0))
19 {
20
21 mysql_query(&mysql,"mysql_query");
22
23 result = mysql_use_result(&mysql);
24 while ( ( row = mysql_fetch_row(result) ) )
25 {
26 printf("%sn",row[0]);
27 }
28 mysql_close(&mysql);
29 }
30 }
31
也错信息如下
[root@localhost c]# gcc -I/usr/local/mysql/include/mysql -lmysqlclient mysql.c
mysql.c: In function `main':
mysql.c:21: error: called object is not a function
为什么说mysql_query()不是函数呢,
2 #include
3 #include
4
5
6 main ( )
7 {
8 MYSQL mysql;
9 MYSQL_RES *result;
10 MYSQL_ROW row;
11 char mysql_query[60]="select `TeamSn` form `team` where 1 and TeamName=";
12 char *team_name="'CHARLEROI'";
13
14
15 strcat(mysql_query,team_name);
16 printf("%s",mysql_query);
17 mysql_init(&mysql);
18 if (mysql_real_connect(&mysql,"192.168.3.111","root","654321","surebet",0,NULL,0))
19 {
20
21 mysql_query(&mysql,"mysql_query");
22
23 result = mysql_use_result(&mysql);
24 while ( ( row = mysql_fetch_row(result) ) )
25 {
26 printf("%sn",row[0]);
27 }
28 mysql_close(&mysql);
29 }
30 }
31
也错信息如下
[root@localhost c]# gcc -I/usr/local/mysql/include/mysql -lmysqlclient mysql.c
mysql.c: In function `main':
mysql.c:21: error: called object is not a function
为什么说mysql_query()不是函数呢,
|
char mysql_query[60]="select `TeamSn` form `team` where 1 and TeamName=";
mysql_query数组与函数同名了。。。。。是不行的!
mysql_query数组与函数同名了。。。。。是不行的!