List:General Discussion« Previous MessageNext Message »
From:Tavaris Thomas Date:April 13 1999 2:49pm
Subject:Fw: mysql: problems with CGIs written in C and mysql
View as plain text  
Can anyone please advise?


>I have since re-instralled a new version of MySQL 3.22.20a
>and the compiler is egcs 1.1.2
>Sun ULTRA 1 using Solaris 2.6
>
>I copied the file
>
>libmysqlclient.a (this is the client library file right?)
>
>into /usr/local/lib and /usr/lib
>
>Here is my new error when I compile (everything is on one line)
>
>
> gcc -I/usr/local/mysql/include/mysql -L/usr/local/mysql/lib/mysql -o test
>test.c
>
>test.c: In function `main':
>test.c:29: warning: return type of `main' is not `int'
>Undefined                       first referenced
> symbol                             in file
>mysql_close                         /var/tmp/cc8KvfIk.o
>mysql_real_connect                  /var/tmp/cc8KvfIk.o
>mysql_init                          /var/tmp/cc8KvfIk.o
>ld: fatal: Symbol referencing errors. No output written to test
>collect2: ld returned 1 exit status
>
>
>here is the code I wrote to test this on...........
>BTW - I am compiling this from the cgi-bin
>
>#include "mysql.h"
>#include <stdlib.h>
>#include "/usr/local/etc/httpd/cgi-bin/NETREG/getcgi.c"
>#include <stdio.h>
>#include <string.h>
>
>
>void main() {
>    char **cgivars ;
>    int i ;
>    MYSQL mysql;
>
>    /** First, get the CGI variables into a list of strings         **/
>    cgivars= getcgivars() ;
>
>    /** Print the CGI response header, required for all HTML output. **/
>    /** Note the extra \n, to send the blank line.                  **/
>    printf("Content-type: text/html\n\n") ;
>
>    printf("<html>\n") ;
>    printf("<head><title>test Results</title></head>\n") ;
>    printf("<body>\n") ;
>
>    mysql_init(&mysql);
>
>    if (!mysql_real_connect(&mysql, "localhost", "tavaris",
>"thomas","network_registration",0,NULL,0))
>       { printf("I didn't connect to the database!\n");}
>     else { printf("I did connect to the database!\n");}
>
>    printf("</body>\n") ;
>    printf("</html>\n") ;
>
>    mysql_close(&mysql);
>}
>
>
>Can you please help me get this stuff to compile? If I need to provide more
>info please let me know. I'll be happy to.
>
>-Tavaris
>
>tavaris@stripped
>

Thread
Fw: mysql: problems with CGIs written in C and mysqlTavaris Thomas13 Apr
  • Re: Fw: mysql: problems with CGIs written in C and mysqlFred Read13 Apr