C++連MYSQL問題

//include左
#include <D:/mysql/include/mysql.h>

//其中一段segment
MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;

char *db_host = "localhost";
char *db_user = "a";
char *db_pass = "b";
char *db_name = "c";

conn = mysql_init(NULL);
mysql_query(conn, "SELECT * FROM config");
res = mysql_use_result(conn);

while ((row = mysql_fetch_row(res)) != NULL)
                      TextOut(hdc,5, 5,row[1], _tcslen(row[1]));

出黎既error係
  [Linker error] undefined reference to `mysql_init@4'
  [Linker error] undefined reference to `mysql_query@8'
  [Linker error] undefined reference to `mysql_use_result@4'
  [Linker error] undefined reference to `mysql_fetch_row@4'
  ld returned 1 exit status
Makefile.win [Build Error]  [weather_control.exe] Error 1

google過但係都係唔明有咩問題
thx

我估係你未using 個namespace

TOP

原帖由 darren05 於 2009-4-13 22:36 發表
我估係你未using 個namespace

已有
我無寫出黎

TOP

成功了
要將libmysql.lib轉做libmysql.a
之後再加返linker....

謝謝各位

TOP