Hi, I am begeener to MySQL. I have installed Suse10 and MySQL and mysql++ in my pc. i want to connect to MySQL through C. When I am compiling the program, I am getting the following error. *********************************************************************** gcc -o test test.c test.c:28:3: warning: no newline at end of file /tmp/cchl7IEh.o: In function `main': test.c:(.text+0x22): undefined reference to `mysql_init' test.c:(.text+0x4f): undefined reference to `mysql_real_connect' test.c:(.text+0x65): undefined reference to `mysql_query' test.c:(.text+0x76): undefined reference to `mysql_store_result' test.c:(.text+0x87): undefined reference to `mysql_num_rows' test.c:(.text+0xdc): undefined reference to `ltmysql_num_fields' test.c:(.text+0xf1): undefined reference to `mysql_fetch_row' test.c:(.text+0x10b): undefined reference to `mysql_close' collect2: ld returned 1 exit status *********************************************************************** The code is as fillows: *********************************************************************** #include <stdio.h> #include <mysql.h> #define host "localhost" #define username "mysql" #define password "" #define database "test" MYSQL *conn; int main() { conn = mysql_init(NULL); mysql_real_connect(conn,host,username,password,database,0,NULL,0); MYSQL_RES *res_set; MYSQL_ROW row; unsigned int i; mysql_query(conn,"SELECT * FROM users WHERE userid=1"); res_set = mysql_store_result(conn); unsigned int numrows = mysql_num_rows(res_set); while ((row = mysql_fetch_row(res_set)) != NULL) { for (i=0; i<mysql_num_fields(res_set); i++) { printf("%s\n",row[i] != NULL ? row[i] : "NULL"); } } mysql_close(conn); return 0; } ***************************************************** Please help me in this regard.
--------------------------------- Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+ countries) for 2ยข/min or less.