3
我要連接下,用下面的代碼到mysql:
鏈接錯誤,當連接C到mysql的
#include <C:\Program Files\MySQL\MySQL Connector C 6.0.2\include\my_global.h>
#include <C:\Program Files\MySQL\MySQL Connector C 6.0.2\include\mysql.h>
#include <stdio.h>
MYSQL *conn; /* pointer to connection handler */
int main (int argc, char *argv[])
{
conn = mysql_init (NULL);
mysql_real_connect (
conn,"localhost","root","","operator", 3306, NULL,0);
mysql_close (conn);
return 0;
}
當我嘗試編譯,我得到:
Error 3 error LNK2019: unresolved external symbol [email protected] referenced in function _main C:\Users\kristel\Documents\Visual Studio 2010\Projects\database\database\database.obj database
Error 4 error LNK2019: unresolved external symbol [email protected] referenced in function _main C:\Users\kristel\Documents\Visual Studio 2010\Projects\database\database\database.obj database
似乎就像缺少東西但我不知道什麼時候。
我已經在圖片添加mysqllib.lib等,但是仍然不解決問題。
只是另一個問題:做我的搜索,我發現了一些關於cmake.Is我的錯誤和cmake之間有任何關係?
謝謝。
我添加了:libmysql和mysqlclient.Is還有另外一個輸入我要添加嗎? – holy 2012-04-09 21:13:14