C and mySQL problems - please help

mfhaque

Registered
i'm trying to use mysql in a C program...so i decided to do a test run before i start...i end up having problems... here's my code...

#include <mysql.h>
#include <stdio.h>


int main()
{
MYSQL *connection,
*mysql;
mysql = mysql_init(NULL);
connection = mysql_real_connect(mysql, "foo.bar.edu", "tech", "PASS","blah",0,NULL,0);

return 0;
}

and i keep getting this error...

"Linking /NewProjects/mysqlTest (1 error)
Undefined symbols

i'm using project builder to compile this. the weird thing is project builder wouldn't highlight where the error is occuring. so i try debugging it myself.
MYSQL *connection,
*mysql;
mysql = mysql_init(NULL);

those are all fine, i got no error on those but when i put

connection = mysql_real_connect(mysql, "dbhost.mscs.mu.edu", "tech", "PASS","blah",0,NULL,0);

error occur .i made sure the path to the header files were correct..

build settings:
HEADER_SEARCH_PATHS = /usr/local/include/mysql/
LIBRARY_SEARCH_PATHS = /usr/local/lib/mysql/
OTHER_CFLAGS =-lmysqlclient

can somebody tell me what i'm doing wrong here.
 
Back
Top