i'm getting the above error when i try to compile this simple program that's attempting to test out embedded mysql:
Code:
#include <mysql/mysql.h>
#include <stdio.h>
int main(void)
{
MYSQL msyql;
MYSQL_ROW row;
MYSQL_RES *result;
unsigned int num_fields;
unsigned int i;
mysql_init(&mysql);
if(!mysql_real_connect(&mysql,"192.168.1.100","root","password","db",o,NULL,o))
{
fprintf(stderr,"Failed to connect to database: Error: %s\n",
mysql_error(&mysql));
}
else
{
if(mysql_query(&mysql,"SELECT * FROM table"));
// error
else
{
result = mysql_store_result(&mysql);
num_fields = mysql_num_fields(result);
while(row = mysql_fetch_row(result))
{
unsigned long *lengths;
lengths = mysql_fetch_lengths(result);
for(i=0; i < num_fields; i++)
{
printf("[%.*s]\t",(int)lengths[i],row[i] ? row[i] : "NULL");
}
printf("\n");
}
}
}
return 0;
}
i'm using the following command to compile:
gcc -filename.c -g -o filename -L /usr/lib/mysql -lmysqlclient
any ideas? :S