2012-06-19 131 views
0

你好我得到這些LNK錯誤,當我嘗試編譯我的MySQL連接代碼錯誤LNK2028:無法解析令牌錯誤

1>main.obj : error LNK2028: unresolved token (0A00027D) "extern "C" struct st_mysql * __stdcall mysql_init(struct st_mysql *)" ([email protected]@[email protected]@[email protected]@Z) referenced in function "int __cdecl main(void)" ([email protected]@$$HYAHXZ) 
1>main.obj : error LNK2028: unresolved token (0A0002B9) "extern "C" struct st_mysql * __stdcall mysql_real_connect(struct st_mysql *,char const *,char const *,char const *,char const *,unsigned int,char const *,unsigned int)" ([email protected]@[email protected]@[email protected]@Z) referenced in function "int __cdecl main(void)" ([email protected]@$$HYAHXZ) 
1>main.obj : error LNK2028: unresolved token (0A0002C8) "extern "C" int __stdcall mysql_query(struct st_mysql *,char const *)" ([email protected]@[email protected]@[email protected]) referenced in function "int __cdecl main(void)" ([email protected]@$$HYAHXZ) 
1>main.obj : error LNK2019: unresolved external symbol "extern "C" int __stdcall mysql_query(struct st_mysql *,char const *)" ([email protected]@[email protected]@[email protected]) referenced in function "int __cdecl main(void)" ([email protected]@$$HYAHXZ) 
1>main.obj : error LNK2019: unresolved external symbol "extern "C" struct st_mysql * __stdcall mysql_real_connect(struct st_mysql *,char const *,char const *,char const *,char const *,unsigned int,char const *,unsigned int)" ([email protected]@[email protected]@[email protected]@Z) referenced in function "int __cdecl main(void)" ([email protected]@$$HYAHXZ) 
1>main.obj : error LNK2019: unresolved external symbol "extern "C" struct st_mysql * __stdcall mysql_init(struct st_mysql *)" ([email protected]@[email protected]@[email protected]@Z) referenced in function "int __cdecl main(void)" ([email protected]@$$HYAHXZ) 

預先感謝您

回答

0

你不能與MySQL庫進行鏈接。

僅僅包含頭文件是不夠的,項目現在必須在哪裏找到MySQL可執行代碼。你可以通過指定要引入的庫來告訴它。

有一個section in the online docs它詳細說明你需要做什麼,它基本上是添加libmysql(假設動態鏈接,請參閱關於靜態情況下的鏈接你想要那個)圖書館的項目。

+0

你能告訴我圖書館嗎?我不知道名字... –

+0

@Pasha,更新了一個到在線文檔的鏈接。 – paxdiablo

+0

我把它連接起來,但我仍然得到這些錯誤。 –

相關問題