|
A simple program, copied online, but unable to compile,
I found all mysql * rpm in the installation disk, and all were installed.
When compiling a simple program, I get the following error. I don't know what else to install?
#Gcc test.c
test.c: In the function ‘main’:
test.c: 19: Warning: implicit declaration is not compatible with the built-in function 'exit'
/tmp/ccOfwWMG.o: In function `main ': test.c :(. text + 0x37): undefined reference to' mysql_init '
: test.c :(. text + 0x63): undefined reference to 'mysql_close'
collect2: ld returns 1
code show as below:
#include <stdio.h>
#include "mysql / mysql.h"
int main (int argc, char ** argv)
{
MYSQL mysql; / * variation # 1 * /
printf ("\n\n\tCopyright Aftab Jahan Subedar\n\t\thttp: //www.geocities.com/jahan.geo");
printf ("\n\t\tjahan@geocities.com\n\t\tPhone: + 88027519050\n");
if (mysql_init (&mysql) == NULL)
{
printf ("\nFailed to initate MySQL connection");
exit (1);
}
/ * now you can call any MySQL API function you like * /
mysql_close (&mysql);
} |
|