Does anybody have any idea why this program won't compile, it seems to
be straightforward, but it I can't get it to compile on Redhat-7.3.

It starts screaming about mysql.h immediately, I use this link to
compile with, on my machine at the house, it compiles just fine and runs
just fine, but I can't get it to compile on any of my other 7.3
machines, does anybody, know what I could be missing, I'm using up to
Redhat rpms of mysql, and I have the devel rpm, so I have all the
libraries and include files. but ???

RPMS on the machines
mysql-devel-3.23.56-1.73
mysql-3.23.56-1.73
mysql-server-3.23.56-1.73

gcc -c -I/usr/include/mysql mysql1.c
In file included from mysql1.c:3:
/usr/include/mysql/mysql.h:127: parse error before `MEM_ROOT'
/usr/include/mysql/mysql.h:127: warning: no semicolon at end of struct
or union
/usr/include/mysql/mysql.h:128: warning: data definition has no type or
storage class
/usr/include/mysql/mysql.h:168: parse error before `MEM_ROOT'
/usr/include/mysql/mysql.h:168: warning: no semicolon at end of struct
or union
/usr/include/mysql/mysql.h:175: parse error before `}'
/usr/include/mysql/mysql.h:175: warning: data definition has no type or
storage class
/usr/include/mysql/mysql.h:182: parse error before `MYSQL_DATA'
------ cut ------ the errors go on quite a bit, but the MEM_ROOT is
pretty instant, and it's over before it begins... anybody ever had this
problem, I've searched google quite a bit, but I can't find what the
deal is and what the problem is. any help appreciated...

/* client1.c - connect to and disconnect from MySQL server */
#include <my_global.h>
#include <mysql.h>
static char *opt_host_name = NULL; /* server host (default=localhost) */

static char *opt_user_name = "username"; /* username (default=login
name) */
static char *opt_password = "password"; /* password (default=none) */
static unsigned int opt_port_num = 0; /* port number (use built-in
value) */
static char *opt_socket_name = NULL; /* socket name (use built-in value)
*/
static char *opt_db_name = "spamassassin"; /* database name
(default=none) */
static unsigned int opt_flags = 0; /* connection flags (none) */
static MYSQL *conn; /* pointer to connection handler */
int
main (int argc, char *argv[])
{
        char sql_command[2048];
        MYSQL_RES       *result;
        MYSQL_ROW       row;
        int state;
        int i;

        /* initialize connection handler */
        conn = mysql_init (NULL);
        if(conn==NULL) {
                fprintf(stderr,"mysql_init() failed (probably out of
memory)\n");
                exit(1);
        }
        /* connect to server */
        if(mysql_real_connect (conn, opt_host_name, opt_user_name,
opt_password,
                            opt_db_name, opt_port_num, opt_socket_name,
opt_flags)
                            ==NULL)
        {
                fprintf( stderr, "mysql_real_connect() failed:\nEror %u
(%s)\n",
                                mysql_errno(conn), mysql_error(conn));
                exit(1);
        }
        /* disconnect from server */


        sprintf(sql_command, "SELECT count(*) from spamassassin.badguys
where badguy like '%s'",argv[1]);

        state = mysql_query(conn,  sql_command);
        if (state!=0) return 0;
        // must call mysql_store_result() before we can issue any other
        // query calls
        result = mysql_store_result(conn);
        if( (row=mysql_fetch_row(result)) != NULL) {
                printf("%s badguys found:  %s\n",row[0],argv[1]);
        }


        // free the result set
        mysql_free_result(result);

        /* disconnect from server */
        mysql_close (conn);
        exit (0);
}



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to