After compiling the following programme segment with
the code
gcc -o exampl2 exampl2.c -L
/usr/lib/mysql/libmysqlclient.so -lmysqlclient -lz
#include
"/usr/local/mysql-max-3.23.55-pc-linux-i686/include/mysql.h"
#include <stdio.h>
#include "/usr/include/assert.h"
#include <stdlib.h>
#include <string.h>
char sql_command[2048];
/*int mysql_update_string_field(char *db_name, char
*table_name,
char *field_name, char
*field_value,
char *whereclause)*/
void main()
{
MYSQL_RES *result;
MYSQL *connection, mysql;
int state;
sprintf(sql_command, "select * from hello");
// connect to the mySQL database at localhost
mysql_init(&mysql);
connection = mysql_real_connect(&mysql,
NULL, /*IP, server
name, or
localhost, or just NULL
for
localhost*/
"root", /*user
name*/
"root123",
/*password*/
"try", /*db
name*/
0, /*port
number*/
NULL, /*Unix
socket name:
an
addition of 3.23?*/
0);
/*client_flag*/
// check for a connection error
if (connection ==NULL) return 0;
state = mysql_query(connection, sql_command);
if (state!=0) return 0;
// must call mysql_store_result() before we can
issue any other
// query calls
result = mysql_store_result(connection);
// free the result set
mysql_free_result(result);
// close the connection
mysql_close(connection);
//return 1;
}
The following messages were displayed:
exampl2.c: In function `main':
exampl2.c:41: warning: `return' with a value, in
function returning void
exampl2.c:44: warning: `return' with a value, in
function returning void
exampl2.c:21: warning: return type of `main' is not
`int'
/usr/bin/ld: cannot find -lmysqlclient
collect2: ld returned 1 exit status
Please suggest any solution.
__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com
--
To unsubscribe, send mail to [EMAIL PROTECTED] with the body
"unsubscribe ilug-cal" and an empty subject line.
FAQ: http://www.ilug-cal.org/node.php?id=3